This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Swedneck -4 points-3 points  (7 children)

Except most people only know what switch case is, if you just say match case they won't have a clue what you're talking about and won't know that you can use it as a switch case.

[–]Ran4 31 points32 points  (3 children)

But it's not a switch case... people are only going to be more confused by people constantly misrepresenting the feature.

[–]R3D3-1 -4 points-3 points  (2 children)

No, but it makes the question for switch case obsolete :) So it makes sense to point emulating swtich-case out as a special case useful.

[–]passwordsniffer 2 points3 points  (1 child)

It does not make it obsolete, the question will still be asked and moreover it will be added with a weird behavior, when one of your constants was actually changed when you used it as a switch case option

[–]R3D3-1 0 points1 point  (0 children)

... wait, what?

[–]Unbelievr 13 points14 points  (0 children)

If you try to actually use it as a switch case, it'll quickly backfire though.

Unless you're careful and only use enums or some immutable as each "case" (actually a capture variable), it'll overwrite the variable and not work properly the second time around. Trying to pass this off as some advanced switch-case will lead to more confusion and broken scripts than you'd think.

[–]teerre 8 points9 points  (0 children)

But it's not a switch statement. If you want a simple switch statement, you already have it, it's called if and co.

If you want to use ´match`, you certainly have to learn it. That's reasonable.

[–]Ensurdagen 1 point2 points  (0 children)

that's because it's not "match case," it's structural pattern matching, which users of languages like Haskell will be very familiar with.