-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Re-implement lazy vals. #7140
Comments
Once this is implemented, we should address one TODO in the following PR: https://github.com/lampepfl/dotty/pull/9181/files#diff-8dc5ee2dbf11efaad4326519edfa4e45R132 The problem is that the current encoding assumes bitmap fields are non-static, thus in #9181 we cannot mark all fields of module classes as |
Hi, I'm currently working on this, assuming the latest scheme is in this file, in the heading comment. Implementing it, I have realized I would need to sort a few things out (I will be referring to lines in the code I linked):
|
Hi, I've also noticed that |
I'm having some trouble with the following:
Therefore, should an extra field be created to store this extra Object for static lazy vals? Or maybe a static field can be avoided in the first place? |
You mean for local lazy vals? I think we might need to box them, which means we have an enclosing object for them. Note that the current lazyvals implementation does the same thing. |
@olsdavis I remember you were saying you may have some time this year to work on this - just checking with you quickly to see if that's the case? |
Hi, @anatoliykmetyuk. I'm back on it. The only issue I'm having is that I want to write this Java expression in Scala: Why I am asking that, it is because the first argument of the CAS is the instance "over which" the CAS should be done. In static context, giving the class instead of an instance works. Therefore, I also need to know how to determine whether a field is going to be "static". (So I can know what to CAS over.) |
Instead of generating a classOf tree you can use |
All Tasty tests seem to pass. However, some I must say that I do not understand why it expects the results it requires. Does anyone have more knowledge about this specific test? Basically, there is the following class: class LazyNullable(a: => Int) {
lazy val l0 = a // null out a
// ...
} It is instantiated with |
Yes, this is needed to avoid memory leaks, it's only done if a is private and the compiler is sure that it isn't used anywhere else, see the pr where this was impleemnted in dotty (scala 2 did the same before): #4289 |
This is needed for memory management. We should release references to
|
OK, thanks a lot. I think I am almost done. |
Hi, so, when I last wrote I just had a few small issues with the tests, as almost all pass except for the following:
Thanks in advance! |
I am not sure about the The |
A clean build did fix Sorry for the lack of precision: in I am glad to announce that the latter is actually the only test not to pass! |
Yes, a difference would be expected here. The only question to ask is whether we are comfortable with the increase in code size. But that's best done by a discussion on a PR. Congrats and thank you for getting this far! Looking forward to see the PR. |
Fix/Fixing/Fixes/Close/Closing/Refs scala#7140
- Implements a propotype of the new lazy vals scheme Fix/Fixing/Fixes/Close/Closing/Refs scala#7140
- Implements a propotype of the new lazy vals scheme Fix/Fixing/Fixes/Close/Closing/Refs scala#7140
superseded by #15296 |
This is the issue that #15296 fixes. |
I'm sorry, I don't know how I confused that. |
I'll take this opportunity to say that I totally get the confusion. I often have to pause and ask is this the issue or the PR? and I've seen others mix them up when commenting, as well. Sorry for the O/T observation that github needs a threading model. I want "one-stop shopping" for the comments and abandoned PRs for a topic. To complement the threading model, I want a "needle" feature that will filter for just the current PR. |
The text was updated successfully, but these errors were encountered: