[#68845] [Ruby trunk - Feature #11056] [PATCH] lib/net/*: use io/wait methods instead of IO.select — normalperson@...
Issue #11056 has been updated by Eric Wong.
3 messages
2015/04/11
[#68945] [Ruby trunk - Feature #11083] [Open] Gemify net-telnet — shibata.hiroshi@...
Issue #11083 has been reported by Hiroshi SHIBATA.
4 messages
2015/04/21
[#68951] Re: [Ruby trunk - Feature #11083] [Open] Gemify net-telnet
— Eric Wong <normalperson@...>
2015/04/21
shibata.hiroshi@gmail.com wrote:
[#69012] [Ruby trunk - Feature #11105] [Open] ES6-like hash literals — shugo@...
Issue #11105 has been reported by Shugo Maeda.
5 messages
2015/04/29
[ruby-core:68924] [Ruby trunk - Bug #11074] [Rejected] Block with optional parameter of same closure variable name
From:
nobu@...
Date:
2015-04-18 06:08:03 UTC
List:
ruby-core #68924
Issue #11074 has been updated by Nobuyoshi Nakada.
Description updated
Status changed from Open to Rejected
Charlton Wang wrote:
> ~~~ruby
> def foo(x=x)
> x
> end
> foo(3)
> => 3
> foo
> => NameError: undefined local variable or method `x' for main:Object
> ~~~
> So at least in this case, it knows that x on the RHS isn't the parameter variable x. This seems a bit inconsistent.
It's an already fixed bug.
----------------------------------------
Bug #11074: Block with optional parameter of same closure variable name
https://bugs.ruby-lang.org/issues/11074#change-52190
* Author: Charlton Wang
* Status: Rejected
* Priority: Normal
* Assignee:
* ruby -v: ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-linux]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
~~~ruby
def bar
yield
end
x = 3
bar do |x=x|
x
end
=> nil
bar do |y=x|
x
end
=> 3
~~~
So perhaps `x=x` isn't able to distinguish that the RHS should probably be the closure `x` and, instead, is take to mean the value of the (new and uninitialized) `x` parameter of the block. But then:
~~~ruby
def foo(x=x)
x
end
foo(3)
=> 3
foo
=> NameError: undefined local variable or method `x' for main:Object
~~~
So at least in this case, it knows that `x` on the RHS isn't the parameter variable `x`. This seems a bit inconsistent.
One can get some really odd results as well:
~~~ruby
def foo(x)
bar do |x=x|
x
end
end
foo(1)
=> 491
foo(1)
=> 498
foo(1)
=> 505
~~~
In this case, `x=x` doesn't render nil as in the previous case. The value of x being returned always increases by 7. Is doing something like `x=x` as a parameter (to a block) generally viewed as being "undefined" behaviour?
Thanks,
Charlton
--
https://bugs.ruby-lang.org/