Open AltGr opened 8 months ago
Decision of the syntax committee over #549 : full pattern matching syntax and .1
, .2
syntax that desugars to full pattern matching, but no let (x, y) = z
(too confusing).
Status update:
foo.1
, foo.2
etc. is now supportedlet (x, y) = z
is still supported and should probably be removed
We agreed to introduce tuples in the surface language (see #529). This is very straightforward, but we also need a way to destruct them to get back their members.
Currently I (locally) have
let a, b, c equals some_triple in ...
to geta
,b
andc
as new variables pointing to the different elements of the triple.We will want that in patterns anyway
match some_triple with pattern -- (a, b, c): ...
. I think the ordering makes this form clearer, but that will come with full-fledged patterns which is further down our TODO listPatterns usually appear in other places, e.g. function arguments:
declaration myfunc content integer depends on x, y, z content (integer, decimal, money) equals ...
Then we get the issue of "function depending on 3 arguments" vs "function depending on a single argument which is a triple". I'd very much like to avoid that and unify the two to make the lives of the users simpler; so the above could be written instead with the multiple-argument syntax:...depends on x content integer, y content decimal, z content money equals...
. Then the function can be called in two ways,myfunc of x, y, z
(current way), but alsomyfunc of some_triple
if the types match.This won't be liked by functional programmers, but it could be a mistake to overlook the very simple and straightforward syntax
some_triple.1
,some_triple.2
,some_triple.3
to get to the different members.