[#69084] [Ruby trunk - Feature #11124] [Open] [PATCH] lib/*: use monotonic clock for timeouts — normalperson@...
Issue #11124 has been reported by Eric Wong.
5 messages
2015/05/06
[#69138] [Ruby trunk - Feature #11136] [PATCH] webrick: avoid fcntl module — nobu@...
Issue #11136 has been updated by Nobuyoshi Nakada.
3 messages
2015/05/12
[#69160] [Ruby trunk - Feature #11146] [PATCH] variable.c: initialize generic_iv_tbl at start — nobu@...
Issue #11146 has been updated by Nobuyoshi Nakada.
4 messages
2015/05/13
[#69175] Re: [Ruby trunk - Feature #11146] [PATCH] variable.c: initialize generic_iv_tbl at start
— Eric Wong <normalperson@...>
2015/05/13
nobu@ruby-lang.org wrote:
[ruby-core:69220] [Ruby trunk - Bug #11160] [Open] Subclasses of Proc converted when passed to a block
From:
alextyu@...
Date:
2015-05-17 22:32:57 UTC
List:
ruby-core #69220
Issue #11160 has been reported by Alex Yu.
----------------------------------------
Bug #11160: Subclasses of Proc converted when passed to a block
https://bugs.ruby-lang.org/issues/11160
* Author: Alex Yu
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v:
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
As Subclasses of Proc are passed as-is when sent to methods as blocks, it would be expected that the same behavior occurs when passing such a subclass of Proc to a block. However, Ruby's block.call somehow converts the block to a Proc, losing the passed subclass. Is this a bug, or is there a particular reason for this design?
Here is an example:
> class MyClass < Proc
> end
=> nil
> def foo (&x)
> p x.class
> end
=> :foo
> x = Proc.new {|&x| p x.class}
=> #<Proc:0x007faf0b042f60@(irb):77>
> z = MyClass.new {}
=> #<MyClass:0x007faf0b0393c0@(irb):78>
> foo &z
MyClass
=> MyClass
> x.call &z
Proc
=> Proc
--
https://bugs.ruby-lang.org/