[ruby-core:70841] [Ruby trunk - Feature #11534] Circular assignment / method shadowing unexpected behavior

From: timsmith3@...
Date: 2015-09-17 16:55:06 UTC
List: ruby-core #70841
Issue #11534 has been updated by Tim Smith.

Tracker changed from Bug to Feature

Then consider it a feature request ;)  First evaluate the righthand side, then make the variable.

----------------------------------------
Feature #11534: Circular assignment / method shadowing unexpected behavior
https://bugs.ruby-lang.org/issues/11534#change-54216

* Author: Tim Smith
* Status: Rejected
* Priority: Normal
* Assignee: 
----------------------------------------
~~~ruby
def foo
  1
end

puts foo + 1

bar = foo + 1
puts bar

foo = foo + 1
puts foo
~~~

~~~
# EXPECTED
2
2
2
~~~
~~~
# ACTUAL
2
2
undefined method `+' for nil:NilClass (NoMethodError)



-- 
https://bugs.ruby-lang.org/

In This Thread

Prev Next