Issue #16670 has been updated by shevegen (Robert A. Heiler). I do not think reddit discussions are that useful, largely because it is difficult to find what is really going on (content-to-noise ratio), and the article title was actually "2.7's pattern matching official docs (recently merged)". zverok is active here on the bugtracker, though, so I suppose he can comment on this issue if he has time and is motivated. :) If I understood your comment, then you refer mostly to the " in " part, and not regular pattern-matching via case/in, yes? If this is the case, and if I do not remember incorrectly, then I think the one-line " in " was suggested by mame, not by the original author who suggested pattern matching. (I mention this just so there is no confusion, because we should be clear with this - ruby users may be confused about which syntax is valid, and which one is not, even more so when it would suddenly change.) Personally I have no specific opinion either way, largely because I am sticking to what is very simple for me to understand; and pattern matching, while interesting, is way over my head. :D But specifically, it may be best if mame and zverok could comment on the proposal, if possible, to compare trade-offs, in particular upon this: expression in {pattern: something} versus {pattern: something} in expression. ---------------------------------------- Feature #16670: Reverse order of `expression` in `pattern` for 1-line pattern matching while it's still experimental https://bugs.ruby-lang.org/issues/16670#change-84465 * Author: ttilberg (Tim Tilberg) * Status: Open * Priority: Normal ---------------------------------------- Currently the 1-line syntax for pattern matching is: ``` # Usage: <expression> in <pattern> expression = { pattern: "Example" } expression in {pattern: something} # something => "Example" ``` Is it technically possible, and desirable to switch the order of this syntax to: ``` # Usage: <pattern> in <expression> expression = { pattern: "Example" } {pattern: something} in expression # something => "Example" ``` ? Here are my reasons: - It is more intuitive in English -- we are "finding a pattern in something". Finding "something in a pattern" doesn't seem to make sense. - Assignment is happening, and this keeps assignment on the left side of the operator which feels more natural. - It matches existing behavior with the workings of the case statement: Understanding that a `case` block evaluates each `when` expression using `when_expression === case_expression` makes more consistency with `when_pattern in case_pattern` using the new operator. ``` case something when /pattern/ end # is equivalent to /pattern/ === something # This creates more parity with case something in {pattern: x} # would be equivalent to {pattern: x} in something ``` Please see the following discussion on Reddit: https://www.reddit.com/r/ruby/comments/favshb/27s_pattern_matching_official_docs_recently_merged/fj2c7ng/ -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>