From: "palkan (Vladimir Dementyev)" Date: 2021-12-20T18:34:46+00:00 Subject: [ruby-core:106748] [Ruby master Bug#18408] Rightward assignment into instance variable Issue #18408 has been updated by palkan (Vladimir Dementyev). This worked originally (when this feature was called "rightward assignment"). But since it has been transformed into a pattern match (in the final 3.0 release), we lost the ability to assign to anything but local vars���that's what pattern matching variable binding supports. I think, it worth to consider adding support for other vars binding in pattern matching in general. Another example: ```ruby case {name: "John", age: 42} in name: /jo/ => @name, age: @age end puts [@name, @age] #=> ["John", 42] ``` ---------------------------------------- Bug #18408: Rightward assignment into instance variable https://bugs.ruby-lang.org/issues/18408#change-95445 * Author: Dan0042 (Daniel DeLorme) * Status: Open * Priority: Normal * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- 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: