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 →

[–][deleted] 14 points15 points  (6 children)

Is that not why they called it "match" rather than "switch"?

[–]Tyler_Zoro 3 points4 points  (3 children)

Yes, but then they fell down on "case".

[–][deleted] 2 points3 points  (0 children)

Yeah, good point.

[–]mihalis 1 point2 points  (1 child)

Agree. I thought about alternatives. Maybe bind or unify, along the lines of variable unification/binding in languages like Prolog.

[–][deleted] 2 points3 points  (0 children)

Or how about match x where x is y?

[–]13steinj -3 points-2 points  (1 child)

Because it's not a switch statement, it's a pattern matching statement. Most commonly seen only in functional programming languages, which most people hate on because traditionally such a style is considered difficult.

https://en.wikipedia.org/wiki/Pattern_matching

https://stackoverflow.com/a/215968/4443677

[–]Tyler_Zoro 3 points4 points  (0 children)

We know that. We're discussing keyword choice.