Open lpil opened 6 years ago
Perhaps a question about the philosophy of the Alpaca language, but do we want both constructs when they serve the same purpose?
At present the existence of both is deliberate. match
existed before function head matching which also got added because I missed having it :) In general I prefer function head matching but I think that it can get a little unwieldy sometimes and it can be cleaner to fall back to a match. It's also consistent in form with the syntax used by receive
and beam
so I think there's enough similarity there to warrant keeping it around.
Having said that, I'm not 100% opposed to trying out deprecating/removing match
as an experiment at some point in the future but:
I don't know if this is a good solution/something worth trying: a compiler flag that disables match
, similar to the possible "decidability" flag that has been discussed elsewhere (would rule type a = int | float
a type error).
Hello!
One thing that Alpaca has inherited from Erlang is the ability to write multiple function heads and use pattern matching to select the one that runs for given arguments.
This serves the same purpose as the
match
expression.Perhaps a question about the philosophy of the Alpaca language, but do we want both constructs when they serve the same purpose?
It would be my preference for there to a single way to express anything in the language as this reduces inconsistency in code written in the language, and also makes the language more approachable by reducing the number of things for newcomers to learn.
Thanks, Louis