From: merch-redmine@... Date: 2019-11-11T18:53:03+00:00 Subject: [ruby-core:95801] [Ruby master Bug#16343] Inconsistent behavior of 'circular argument reference' error Issue #16343 has been updated by jeremyevans0 (Jeremy Evans). On Ruby 2.2-2.6, there is a warning instead of an error in the first case, but I think that is invalid. The reason for the warning/error is to complain about this code: ```ruby def a(b=b) b end ``` Here, `a` would return `nil`, because of how the default argument values are handled. The reason the warning was added is because in Ruby 2.1 and below, calling `a` with no arguments would call the `b` method to get the value for the `b` argument. `m { |foo = proc { || foo }| }` is not a case I think we should warn about, since it doesn't have the same issue. `m { |foo = proc { || foo }.call| }` could have the same issue, but it seems unlikely to occur in real world code. ---------------------------------------- Bug #16343: Inconsistent behavior of 'circular argument reference' error https://bugs.ruby-lang.org/issues/16343#change-82622 * Author: ibylich (Ilya Bylich) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.7.0dev (2019-11-04T16:32:26Z trunk a087e027bf) [x86_64-darwin19] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- The following code gives a syntax error: ``` ruby m { |foo = proc { || foo }| } # => SyntaxError (-e:14: circular argument reference - foo) ``` But this code is valid: ``` ruby m { |foo = proc { |bar| foo }| } ``` Is it intentional? `foo` becomes a proc that returns itself, so there must be a circular dependency -- https://bugs.ruby-lang.org/ Unsubscribe: