Actions
Bug #12501
closedAssignment to local variable itself doesn't occur an error
Description
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?
Updated by shevegen (Robert A. Heiler) almost 8 years ago
I think it is neither a feature nor a bug but simply a consequence of how the ruby parser (or was it
the lexer or scanner) reads/parses the code. The pickaxe mentioned that once, if I remember correctly.
Updated by nobu (Nobuyoshi Nakada) almost 8 years ago
- Description updated (diff)
- Status changed from Open to Rejected
Actions
Like0
Like0Like0