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. 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()”. 

—Guy

> On Sep 7, 2020, at 5:36 AM, Alan Malloy <amal...@google.com> wrote:
> 
> 
> I would be very surprised if that were valid. The inner vars are fine, of 
> course. However, your outer one has not replaced a type, but a deconstructor 
> reference, or whatever we're calling the opposite of a constructor. "Any 
> object which can be deconstructed into two constituent objects" will surely 
> not be a useful query very often, and I wouldn't expect the language to 
> support it.
> 
>> On Mon, Sep 7, 2020, 1:24 AM Remi Forax <fo...@univ-mlv.fr> wrote:
>> Just a question,
>> do we agree that the syntax below is valid ?
>> 
>>   Point point = ...
>>   switch(point) {
>>     case var(var x, var y): ...
>>   }
>> 
>> i.e. that var can be written everywhere there is a type in a Pattern.
>> 
>> Rémi

Reply via email to