----- Mail original ----- > De: [email protected] > À: "Brian Goetz" <[email protected]> > Cc: "Remi Forax" <[email protected]>, "amber-spec-experts" > <[email protected]> > Envoyé: Mercredi 19 Avril 2017 16:48:36 > Objet: Re: Published: pattern matching
> On 2017-04-19T10:34:31 -0400 > Brian Goetz <[email protected]> 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. Rémi
