From: kazuki@... Date: 2020-12-28T16:18:21+00:00 Subject: [ruby-core:101784] [Ruby master Feature#17411] Allow expressions in pattern matching Issue #17411 has been updated by ktsj (Kazuki Tsujimoto). I am basically positive. (I've had the same idea. :) https://speakerdeck.com/k_tsj/pattern-matching-new-feature-in-ruby-2-dot-7?slide=64) But I've been a little concerned most of languages which have pattern matching don't support such syntax. If there were a obvious reason, I'd like to know that. ---------------------------------------- Feature #17411: Allow expressions in pattern matching https://bugs.ruby-lang.org/issues/17411#change-89612 * Author: zverok (Victor Shepelev) * Status: Open * Priority: Normal * Assignee: ktsj (Kazuki Tsujimoto) ---------------------------------------- Code: ```ruby version = {name: '2.6', released_at: Time.new(2018, 12, 25)} version in {released_at: Time.new(2010)..Time.new(2020)} # ^ syntax error, unexpected '.', expecting '}' # This works: range = Time.new(2010)..Time.new(2020) version in {released_at: ^range} #=> true ``` (Fails with all versions of the pattern matching, `in`, `=>` and `case ... in`, and on Ruby 2.7 too.) Am I missing something about the syntax?.. -- https://bugs.ruby-lang.org/ Unsubscribe: