If a computation graph is acyclic, a computation node (or thunk) of the graph will be evaluated at most once and can be trivially shared. I think it is not a problem even in Scala (except for the initialization order problem, of course), right?
-
-
Replying to @m2ym
Once again, Scala doesn't implement inheritance of lazy fields. If you "simply" inherit a nullary function definition instead, you get exponential effect duplication and lack of proper state sharing as children inherit.
1 reply 0 retweets 0 likes -
Replying to @Ngnghm
Stumble upon this issue. So what you mean by "incorrect" is that overriding lazy vals with super self-reference goes wrong?https://github.com/lampepfl/dotty/issues/1999 …
1 reply 0 retweets 1 like -
Replying to @m2ym
My understanding is that in Scala, you're not allowed to reference the inherited value of the lazy val from the super class.
1 reply 0 retweets 0 likes -
Replying to @Ngnghm
I think this problem is essentially caused by a name collision. In Jsonnet, there seems to be two namespaces: self and super. Actually "jsonnet -e '{ a: 1, b: 2 } { a: super.b, b: 3, c: self.b }'" says "{ a: 2, b: 3, c: 3 }",
1 reply 0 retweets 0 likes -
(cont) which cannot be constructed if there is just one namespace (or cell).
2 replies 0 retweets 0 likes -
Replying to @m2ym
Which is why my proposal for how to implement that in Scala involved one cell per override / one namespace per superclass.
1 reply 0 retweets 0 likes -
Replying to @Ngnghm
Fully understand. Great proposal. I have never been aware of that problem.
1 reply 0 retweets 1 like -
-
Replying to @Ngnghm
Sad. Though I understand why rejected, my honest feeling about it is that it is not lack of feature, but lack of proper implementation. We should not use lazy vals except in a trivial situation.
1 reply 0 retweets 0 likes
I would totally have accepted a "low priority, not doing it now, do it yourself and send a patch if you care" answer as valid. The "never gonna do it, closing" answer, on the other hand, was quite disappointing.
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
Read my blog!