Re: "With" for records

2022-06-12 Thread Brian Goetz
On 6/12/2022 12:21 PM, fo...@univ-mlv.fr wrote: *From: *"Brian Goetz" *To: *"Remi Forax" *Cc: *"amber-spec-experts" *Sent: *Saturday, June 11, 2022 8:16:26 PM *Su

Re: "With" for records

2022-06-12 Thread forax
> From: "Brian Goetz" > To: "Remi Forax" > Cc: "amber-spec-experts" > Sent: Saturday, June 11, 2022 8:16:26 PM > Subject: Re: "With" for records > We also probably want a rule to _prevent_ assignment to any locals *other > than*

Re: "With" for records

2022-06-11 Thread Brian Goetz
We also probably want a rule to _prevent_ assignment to any locals *other than* the synthetic component locals.  Assigning to uplevel locals from within a `with` block seems like asking for trouble; the with block is like a transform on the component locals. However, we may need a story (hope

Re: "With" for records

2022-06-11 Thread Brian Goetz
I got a private mail asking, basically: why not "just" generate withers for each component, so you could say `point.x(newX).y(newY)`. This would be a much weaker feature than is being proposed, in several dimensions. 1.  It doesn't scale to arbitrary classes; it's a record-specific hack.  Wh

Re: "With" for records

2022-06-10 Thread Brian Goetz
The block is also special because there is an implicit return at the end ? so i believe "return" should be disallowed inside the block, right ? That's a good question; we can go in multiple directions with this. One would be to simply interpret "return" as "return from the enclosing method

Re: "With" for records

2022-06-10 Thread Remi Forax
> From: "Brian Goetz" > To: "amber-spec-experts" > Sent: Friday, June 10, 2022 2:44:51 PM > Subject: "With" for records > In > [ > https://github.com/openjdk/amber-docs/blob/master/eg-drafts/reconstruction-records-and-classes.md > | > ht

"With" for records

2022-06-10 Thread Brian Goetz
In https://github.com/openjdk/amber-docs/blob/master/eg-drafts/reconstruction-records-and-classes.md we explore a generalized mechanism for `with` expressions, such as:     Point shadowPos = shape.position() with { x = 0 } The document evaluates a general mechanism involving matched pairs of