Published: pattern matching

forax at forax at
Wed Apr 19 15:00:04 UTC 2017

----- Mail original -----
> De: mark at
> À: "Brian Goetz" <brian.goetz at>
> Cc: "Remi Forax" <forax at>, "amber-spec-experts" <amber-spec-experts at>
> Envoyé: Mercredi 19 Avril 2017 16:48:36
> Objet: Re: Published: pattern matching

> On 2017-04-19T10:34:31 -0400
> Brian Goetz <brian.goetz at> wrote:
>> Yes, we considered it.  But the reason for preferring var here is not
>> necessarily just compiler complexity; it's that it's weird for
>>      if (x matches Foo(y))
>> to be a _declaration_ for y.  Java developers are not used to that.
> Strongly agree here. I've taken a few programmers with no Haskell
> experience through introductions to Haskell and one thing that reliably
> trips them up is that patterns introduce bindings in a way that's not
> totally explicit.
>  f :: Nat -> Nat
>  f Zero     = ...
>  f (Succ z) = ...
> "Where is this z variable declared?! Oh, right..."
> M

while i do not disagree, making things explicit is usually a win,
i see the same issue with my student the first time they see the lambda syntax (z) -> ...
given that the proposed syntax for the pattern matching also uses '->', it maybe less hard.


More information about the amber-spec-experts mailing list