-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Add Eval documentation #1816
Add Eval documentation #1816
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1816 +/- ##
==========================================
+ Coverage 94.88% 94.96% +0.07%
==========================================
Files 241 241
Lines 4148 4173 +25
Branches 102 106 +4
==========================================
+ Hits 3936 3963 +27
+ Misses 212 210 -2
Continue to review full report at Codecov.
|
This does not seem to mention that some uses of nested Ideally, you never call |
note for instance #1703 which I think may be currently broken still. |
Can we add an example of using another note: it would be really nice to have some, even non-rigorous, benchmarks on Eval. In fact, Eval is MUCH slower than using standard function calls. So if you are doing it to get stack safe recursion, if you know the recursion depth will be shallow, you may be much better off with normal on-stack recursion. cc @non |
|
||
#### Eval.later | ||
|
||
If we want lazy evaluation, we can use `Eval.later`: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worthy mentioning here that there are two advantages of Later
over lazy val
Later
allows the thunk being GC'd after evaluation andLater
's synchronization lock locks itself while lazy vals lock their enclosing class. Discussed in detail here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @LukaJCB!
I think that @johnynek and @kailuowang have raised some good points, but I also think that having this documentation is much better than having none for Eval
, and I think that they could be addressed in followup PRs.
I agree with @ceedubs that having this is much better than having none, @LukaJCB what do you think? Do you think those points are super quick to address or do you want to iterate fast? |
I did address @kailuowangs points and I also added a small note on |
Merging with 2 approvals. I do think that @kailuowang's suggestion to link to Erik's talk on |
Adds some eval documentation with very basic examples, not sure if there are better examples around that can better showcase the usefulness of
Eval
. Either way, looking forward to feedback :)