Finalizing in JDK 16 - Pattern matching for instanceof

John Rose john.r.rose at
Thu Sep 24 00:57:11 UTC 2020

On Sep 23, 2020, at 12:14 PM, John Rose <john.r.rose at> wrote:
> I am convinced that (under broad presuppositions) reconstruction
> expressions *should* allow mutation to their internal bindings.

P.P.P.S. I updated my case study [1] to point at Brian’s more recent
document [2], and realized that my “broad presuppositions” are
exceedingly broad, and probably nobody is arguing *against*
something like with-blocks.  Still, I would like to go on record
as preferring fully imperative blocks, with the option to specify
localized side effects like `i++` and/or control flow, to the
alternative syntaxes on the table.  Those would be, AFAIK:

(a) positionally-parameterized constructors and factories *only*
(as in `p=Point.of(p.x,p.y+1)`), and

(b) a halfway point of constructors and factories which
allow named arguments with suitably tuned defaults
(as in `p=p.with(y: p.y+1)`).

(Brian has a clever way to desugar general with-blocks into
call-with-named-arguments, under the heading “Making names
significant”.  And that would be super-useful in its own right.
But I still like the fully imperative with-block far more than (b).)


More information about the amber-spec-experts mailing list