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 not) for _accessing_ uplevel shadowed
locals. For example:
record R(A contents) { }
record A(B contents) { }
record B(int contents) { }
R r = ...
R rr = r with { contents = contents with { contents = 3 }}
it is possible that the inner block might want additional information
from one of the enclosing `contents` variables.
On 6/10/2022 11:25 AM, Brian Goetz wrote:
About the declaration of local variables, in Java, there is no
hiding/shadowing between local variables, so a code like this is
rejected ? Or do we introduce a special rule for the hiding of
implicit variables ?
Yes, we probably do need a special rule for this. The component names
are fixed, and collisions are likely, so these synthetic variables
will probably have to be allowed to shadow other locals.