[#69616] [Ruby trunk - Feature #11258] add 'x' mode character for O_EXCL — cremno@...
Issue #11258 has been updated by cremno phobia.
3 messages
2015/06/16
[#69643] [Ruby trunk - Misc #11276] [RFC] compile.c: convert to use ccan/list — normalperson@...
Issue #11276 has been updated by Eric Wong.
3 messages
2015/06/17
[#69751] [Ruby trunk - Bug #11001] 2.2.1 Segmentation fault in reserve_stack() function. — kubo@...
Issue #11001 has been updated by Takehiro Kubo.
3 messages
2015/06/27
[ruby-core:69674] [Ruby trunk - Bug #11283] Block assigned implicitly
From:
andrew.kozin@...
Date:
2015-06-19 05:49:52 UTC
List:
ruby-core #69674
Issue #11283 has been updated by Andrew Kozin.
Not, in my examples (from the initial post) it does not do that, but something different. Namely, it doesn't assigning a **new** proc (that would be OK)
Instead, the interpreter it looks around in search **what else** it could use when I doesn't send a proc, then takes what it found somewhere and pushes it to the method.
MRI doesn't let me decide whether the method should be called without a proc (that should be interpreted as asking for `Proc.new`, as in your example).
**This** is the bug, not the way it works out the `:define_method` call.
----------------------------------------
Bug #11283: Block assigned implicitly
https://bugs.ruby-lang.org/issues/11283#change-53034
* Author: Andrew Kozin
* Status: Open
* Priority: Normal
* Assignee:
* ruby -v: 1.9.3, 2.0, 2.1, 2.2, ruby-head
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
That is how it works:
module Test
def self.build(&block)
klass = Class.new(Object)
klass.__send__(:define_method, :foo)
klass.__send__(:define_method, :bar)
klass
end
end
Tested = Test.build { :foo }
# warning: tried to create Proc object without a block
# => Tested
Tested.new.foo
# => :foo
Tested.new.bar
# => :foo
The block is assigned to all calls to `:define_method` via `Object#__send__` implicitly, while it wasn't asked to.
The behaviour is tested under MRI 1.9.3, 2.0, 2.1, 2.2, ruby-head. It doesn't occur under rbx-2 and jruby (1.7, 9.0.0.0).
For the context look at this thread https://github.com/mbj/mutant/issues/356
--
https://bugs.ruby-lang.org/