Hacker News new | past | comments | ask | show | jobs | submit login

> Pattern matching without support for algebraic datatypes really misses the point.

The idea that pattern matching has only one point misses the point.

> What you want is to be able to declare all the shapes of your data, with descriptive names, and then be able to say definitely "these are the only such shapes."

While that is useful, it's not always the most important thing I want with pattern matching, it's usually a nice to have. If I can match on the shapes I can meaningfully handle in a particular point and use a default case with appropriate behavior (which may be to report an error condition) for any others, that's often enough.




The problem is that blog posts often start out with the phrase "pattern matching like haskell or scala" and then describe a mechanism that is not like thoseā€”it misrepresents and conflates what those languages provide.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: