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 elements.

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

Reply via email to