From: "palkan (Vladimir Dementyev)" Date: 2022-01-11T08:19:19+00:00 Subject: [ruby-core:107046] [Ruby master Feature#18408] Allow pattern match to set instance variables Issue #18408 has been updated by palkan (Vladimir Dementyev). baweaver (Brandon Weaver) wrote in #note-4: > While we're in that domain where would we want to draw the line? Globals, constants, class variables? > ... > Anyways, point being we should probably decide where the line is on what can and cannot be assigned into. I would posit the answer should be that if it can be assigned to in normal Ruby it should be assignable in any pattern matching syntax for consistency lest someone open another issue on a type we skipped. I think, the phrase "variable assignment" draws a line here: any variable (local, instance, class, global) could be assigned / pinned (already implemented in 3.1). (Both parse.y and Parser operates the terms "identifier" (lvar) and "nonlocal_var" (instance, class, global)). ---------------------------------------- Feature #18408: Allow pattern match to set instance variables https://bugs.ruby-lang.org/issues/18408#change-95877 * Author: Dan0042 (Daniel DeLorme) * Status: Open * 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: