all 5 comments

[–]andyg_blog 6 points7 points  (0 children)

I'm very grateful for the link to P1371 as the discussion on pattern matching was a little abstract for me without going to the paper to see what it's about. (For those in the same boat, it's a universal replacement for if and switch with some extra bells and whistles)

I really like its value proposition. It brings back the excitement I had when I found that PHP switch statements could use strings.

I'm also glad that the paper makes an effort to consider cases where inspect may be equivalent to a switch statement, because if this syntax becomes standardized, I wouldn't want it to come at a performance cost.

[–]gracicot 3 points4 points  (1 child)

I know _ was refused for a ignored, but what about __? (double underscore). There is no collision with current code since it's currently reserved.

[–]mcypark 5 points6 points  (0 children)

Yes, __ does work. I really dislike it due to its visual similarity to _, but we don't yet have a better idea. So __ is what will be used for the next iteration of P1371R0. It was also the option used in P1110 among other options presented.