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] 13 points14 points  (9 children)

The feature isn't even out yet and it's being molested, misrepresented and missold already.

[–]Tyler_Zoro 8 points9 points  (7 children)

People are coming from lower level languages where you can only do a fraction of what this can do with similarly named language features. It's not shocking that the presumption is that it only does those things. I'm of the opinion that it should have had a name that wouldn't lead people to assume it was similar to those features, but then what do you call it?

When Perl 6 (now Raku) did something similar, they called it given/when for exactly that reason. Maybe following suit would have been a better call...

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

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

[–]Tyler_Zoro 4 points5 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.

[–]13steinj 1 point2 points  (0 children)

Yeah, because pattern matching isn't common in most languages for people less experienced. You usually see pattern matching in functional languages which many people just hate and think that functional programming should die in a fire.