5 ms·
No, have a look at Erlang! Pattern matching is one of it's most powerful feature.
by lpgauth 8y ago
No, have a look at Erlang! Pattern matching is one of it's most powerful feature.
- gmfawcett 8y agoAnd Prolog as well, which strongly influenced Erlang's design. (The original Erlang was written in Prolog.) I agree with the sentiments of some of the other commenters -- it's much less troublesome to match on tuples (Erlang) and predicate clauses (Prolog) than it is to match on JavaScript objects. With tuples/clauses, the constructor syntax mirrors the pattern matching syntax, so it's trivial to read the code at a purely syntactic level to debug pattern matching issues, and this would simplify automatic static analysis as well. As soon as you can add "fields" to an object at arbitrary (non-local) points in the code, local syntactic analysis becomes intractable.