From: "Eregon (Benoit Daloze)" Date: 2022-01-18T17:52:44+00:00 Subject: [ruby-core:107180] [Ruby master Feature#18408] Allow pattern match to set instance variables Issue #18408 has been updated by Eregon (Benoit Daloze). IMHO there is no such thing as "undefined behavior" in Ruby, the behavior is whatever CRuby currently does, and with enough time people depend on it. In this case I think it's best to "keep it stupid and simple" and just assign while doing the match, which is the current behavior. Anything else is far more complicated, incurs additional assignments (so slower for CRuby), and would use more stack space for pattern matching. ---------------------------------------- Feature #18408: Allow pattern match to set instance variables https://bugs.ruby-lang.org/issues/18408#change-96040 * Author: Dan0042 (Daniel DeLorme) * Status: Assigned * Priority: Normal * Assignee: ktsj (Kazuki Tsujimoto) ---------------------------------------- I expected this to work: ```ruby 42 => @v ``` But instead it raises "syntax error, unexpected instance variable" Is this intentional? -- https://bugs.ruby-lang.org/ Unsubscribe: