Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

for some reason (probably a bad one) i love switch statements and i look forward to the match expression


for whatever reason (also probably a bad one), i hate the syntax of switch statements, and for that reason i almost never use them. the match expression though, i'm actually very excited about. i quite like the mapped look; it seems more intuitive to read.


nothing wrong with switch statements.


Coerced-typed (weak) comparisons and easy accidental fallthrough are the problems commonly associated with switch statements.

The new match construct fixes both of these and is also an expression instead of a statement, allowing for more expressive code.




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

Search: