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

From looking at the proposal, there are substantial differences. The biggest is that switch is an equality test on a single value, while pattern matching as proposed allows matching on multiple properties of an object, as well as conditional clauses.

I need to look at it more closely, as some languages have matching be an expression, rather than a statement or block like the conventional switch.

It doesn't add something that you can't already do- tcomb and other libraries offer functions that mimic it- but it changes the way you can express certain ideas without needing them, in a way that is already familiar from other languages.

EDIT: yes, it does look like an expression, which means it can be used in many more places than a standard switch.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: