[#74190] [Ruby trunk Feature#12134] Comparison between `true` and `false` — duerst@...
Issue #12134 has been updated by Martin D端rst.
3 messages
2016/03/07
[#74269] Type systems for Ruby — Rob Blanco <ml@...>
Dear ruby-core,
5 messages
2016/03/10
[#74395] [Ruby trunk Feature#12142] Hash tables with open addressing — shyouhei@...
Issue #12142 has been updated by Shyouhei Urabe.
3 messages
2016/03/17
[ruby-core:74538] [Ruby trunk Feature#12214] Inconsistent behaviour and lack of warnings/errors when referencing duplicated _variables
From:
martin@...242.net
Date:
2016-03-24 16:48:40 UTC
List:
ruby-core #74538
Issue #12214 has been reported by Martin Tournoij.
----------------------------------------
Feature #12214: Inconsistent behaviour and lack of warnings/errors when referencing duplicated _variables
https://bugs.ruby-lang.org/issues/12214
* Author: Martin Tournoij
* Status: Open
* Priority: Normal
* Assignee:
----------------------------------------
_, _ = [1, 2]
p _
gives `2`
def foo _, _
p _
end
foo 1, 2
gives `1`
def foo _, _=2
p _
end
foo 1
gives `2`
In other words, referencing duplicated variables starting with an underscore gives inconsistent results.
In the first example it makes since since it's basically:
_ = 1
_ = 2
In the method it makes a bit less sense, especially since the behaviour is inconsistent.
My suggested fix would be to at least make referencing duplicated _variables a warning with `ruby -w`. Perhaps it also makes sense to do this for *all* _variables, since the underscore indicates you should not reference them...
It could, perhaps, even me made an error to reference duplicated variables like this. The behaviour is surprising, and likely to change in future versions of Ruby...
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>