Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce circular dependencies #26

Merged
merged 10 commits into from
Nov 9, 2024
Merged

Conversation

Baptouuuu
Copy link
Member

Problem

Same as Innmind/framework#3

Solution

Same as Innmind/framework#3 for lazy monads.

For deferred monads we capture a weak reference to $this and the callable that will generate the value. At unwrap time if the weak reference still holds a value then the user still holds a reference to the monad so we call the unwrap method on it so both the initial value is memoized and the mapped value where we unwrap. If it doesn't contain a value it means the monad was freed from memory and so there's no need to store the intermediary value, we can call the callable to generate the value.

@Baptouuuu Baptouuuu added the bug Something isn't working label Nov 9, 2024
@Baptouuuu Baptouuuu self-assigned this Nov 9, 2024
Copy link

codecov bot commented Nov 9, 2024

Codecov Report

Attention: Patch coverage is 99.39759% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.42%. Comparing base (085455d) to head (a26cc19).
Report is 11 commits behind head on develop.

Files with missing lines Patch % Lines
proofs/maybe.php 96.96% 1 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop      #26      +/-   ##
=============================================
+ Coverage      97.04%   97.42%   +0.37%     
- Complexity       965      974       +9     
=============================================
  Files             63       64       +1     
  Lines           3252     3376     +124     
=============================================
+ Hits            3156     3289     +133     
+ Misses            96       87       -9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Baptouuuu Baptouuuu merged commit 5182a4b into develop Nov 9, 2024
21 checks passed
@Baptouuuu Baptouuuu deleted the reduce-circular-dependencies branch November 9, 2024 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant