Collections patterns

Brian Goetz brian.goetz at
Fri May 20 13:04:27 UTC 2022

>     Or maybe you mean something else; if so, please share!
> The current proposal is more about matching and extracting the first 
> arguments

It is really about matching *the whole array*.   Pattern matching is 
about destructuring.  Arrays are part of the language.  They have 
structure.  We give people a way to make arrays by specifying all the 
elements; pattern matching deconstructs the array by matching all the 

> than matching/extracting the last arguments or the rest are also 
> useful IMO.
> By example, if i want to parse command line arguments composed of 
> options and a filename, i may want to write something like
>   case [String... options, String filename] -> ...
>   case [String...] -> help()

Just because something is useful doesn't mean it has an equal claim to 
be a language feature.  (Arrays are a language feature; inserting into 
the middle of a sequence is useful, but arrays don't offer that -- we 
have lists for that.  That doesn't make arrays broken.  Lists are a 
different feature.)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the amber-spec-experts mailing list