Towards Minimal L World
john.r.rose at oracle.com
Thu May 17 22:22:59 UTC 2018
On May 17, 2018, at 11:07 AM, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
> While I think going down into a syntactic bikeshed right now would be way too premature, IMHO, one thing that the language has to figure out is how the construction model for value types is exposed to programmers. Withers are very good at the bytecode level, not so much at the source level. Whatever we can do to minimize the entry barrier there I think would be very welcome.
I think our starting point is porting classic Java constructor
syntax & semantics to the value world. This gives programmers
a way (which is awkward but workable) to build withers etc.
A Java constructor in a value class will internally use withfield
to translate any assignment of the form "this.x = y", and instead
of the blank instance being an incoming reference in L, the
constructor builds a blank value instances out of thin air using
An explicit wither can simply reconstruct another instance from
scratch. This is a workaround in place of direct access to a single
wither instruction, using a special syntax. (…Which has been
previously discussed in terms like v2=__With(v.x, y) or something
similar.) As a workaround, classic Java constructors are good
enough to allow other experiments to get off the ground. After
all, they are good enough for VBCs.
P.S. Teaser: Generalizing classic Java constructors to cover the
case of withers and ad hoc update instructions is the subject of a
forthcoming-but-delayed memo concerning "reconstructors".
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the valhalla-spec-experts