From: shevegen@... Date: 2016-06-17T20:18:54+00:00 Subject: [ruby-core:76065] [Ruby trunk Bug#12501] Assignment to local variable itself doesn't occur an error Issue #12501 has been updated by Robert A. Heiler. I think it is neither a feature nor a bug but simply a consequence how the ruby parser (or was it the lexer or scanner) reads the code. The pickaxe mentioned that once, if I remember correctly. ---------------------------------------- Bug #12501: Assignment to local variable itself doesn't occur an error https://bugs.ruby-lang.org/issues/12501#change-59262 * Author: Yu Zhang * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.3.0 * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- For example: ~~~ a = b # => undefined local variable or method `b' for main:Object (NameError) ~~~ but ~~~ a = a # => nil a = a.merge({}) # => undefined method `merge' for nil:NilClass (NoMethodError) ~~~ The `a` after `=` is an undefined local variable, I think it should raise a `NameError`, but it only returns a nil value. Is this a feature or bug? -- https://bugs.ruby-lang.org/ Unsubscribe: