scala-dev icon indicating copy to clipboard operation
scala-dev copied to clipboard

new lazy val locking scheme

Open adriaanm opened this issue 8 years ago • 7 comments

see one gotcha in https://github.com/lampepfl/dotty/pull/2276

adriaanm avatar Apr 21 '17 20:04 adriaanm

not possible to change in 2.13.x

SethTisue avatar Mar 09 '20 13:03 SethTisue

Why ? It's possible to change the lazy val scheme without breaking binary-compatibility.

smarter avatar Mar 09 '20 13:03 smarter

Also see https://github.com/lampepfl/dotty/issues/7140 / https://github.com/lampepfl/dotty/pull/6979 for the latest proposal.

smarter avatar Mar 09 '20 13:03 smarter

Adriaan is concerned about other kinds of risk (e.g. around locking) as well as binary compatibility, but sure, we can keep it open.

SethTisue avatar Mar 09 '20 13:03 SethTisue

new lazy val implementation recently landed in Scala 3 over at https://github.com/lampepfl/dotty/pull/15296 by @szymon-rd

SethTisue avatar Oct 31 '22 19:10 SethTisue

@szymon-rd is there a detailed description of the lazy vals new scheme? The list of "Advantages" in https://github.com/lampepfl/dotty/pull/6979 sounds good. But it's definitely a risky thing to touch.

lrytz avatar Nov 04 '22 15:11 lrytz

@lrytz The advantages in this ticket are up to date. It also fixed a bug with @transient and simplified overall structure. The multithreaded performance is better too, benchmarks are in the PR. Regarding the risk - I agree that it is significant, but luckily we now have the open community build and we run all the Scala projects and their tests, we also run all the tests containing lazy vals for the new implementation. The scheme itself is included in the comment in the LazyVals transform class, where it is generated.

szymon-rd avatar Nov 04 '22 17:11 szymon-rd