-
Notifications
You must be signed in to change notification settings - Fork 334
Make sure suspended blocks are evaluated only once #14530
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
base: develop
Are you sure you want to change the base?
Conversation
Akirathan
left a comment
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.
compute =
ref.put (ref.get+1)
"Value"
is not a lazy block. It is a method. It should be executed every time is is called. That is the correct and expected semantics. There is no such thing as a lazy block, unless you specifically define it.
I don't believe that "Snowflake tests is slow, because I am running it via enso --run test/Snowflake_Tests" is a sufficient justification for changing the parameterless method semantics in this way.
To make Snowflake tests faster:
- Run just a single test file, ano not the entire project
- Or start introducing lazy atom fields, just like we have them in benchmarks.
| * @return the truffle nodes corresponding to `block` | ||
| */ | ||
| private def processBlock(block: Expression.Block): RuntimeExpression = { | ||
| if (block.suspended) { |
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.
block.suspendedcheck
|
|
What's the implication for? I do agree that What would: do currently? Does it eval as an assignment or become a function? |
This remains unchanged. It is a definition of static method on
It is an assignment. One would need to write: to make it a function/thunk (prior to this PR) or suspended block (with changes in this PR). |
Thanks - then I think I am happy with this. I do worry it is a little subtle and something like ccing @AdRiley and @GregoryTravis as they may not have seen this |
|
|
Although suspended lazily assigned variables can be modeled with lazy atom fields, it may be worth to invest some time in this feature. Because rewriting simple variables to lazy fields is hard - I was personally doing that in Syntax: if my vote counts for something, I am voting for the third option - prefixing with tilde -
Until now, I had no idea that enso/distribution/lib/Standard/Base/0.0.0-dev/src/System/File.enso Lines 1141 to 1152 in c1698db
Method.Explicit with suspended block as the body. Interesting.
Still, I would not touch that and rather introduce a special syntax for suspended lazily assigned variables. |
|
I'm happy with either syntax, Would this change mean that this is fixed? #9814 :) |
Pull Request Description
Important Notes
test/Base_Testshad to be updatedChecklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,