Is case var(var x, var y) a valid syntax ?

Brian Goetz brian.goetz at oracle.com
Mon Sep 7 16:55:41 UTC 2020


> I agree with Alan. While I believe that Rémi is correct insofar as you 
> can write “var” in place of a type in any type pattern “T x”, in a 
> deconstruction pattern “P(...) [d]” the occurrence of P is not a type; 
> rather, it names a deconstructor. 

Exactly right.

> It does so happen that right now all deconstructors (like all 
> constructors) share the name of an associated type, but it is 
> important not to confuse them. You cannot replace a deconstructor name 
> with “var” any more than you can write “new var()” or “new 
> MyInterface()”.

or `new var[3]` or `import var` or `Foo<var> = e`.



More information about the amber-spec-experts mailing list