[#66678] [ruby-trunk - Feature #10481] Add "if" and "unless" clauses to rescue statements — alex@...
Issue #10481 has been updated by Alex Boyd.
3 messages
2014/12/04
[#66762] Re: [ruby-changes:36667] normal:r48748 (trunk): struct: avoid all O(n) behavior on access — Tanaka Akira <akr@...>
2014-12-10 0:44 GMT+09:00 normal <ko1@atdot.net>:
3 messages
2014/12/10
[#66851] [ruby-trunk - Feature #10585] struct: speedup struct.attr = v for first 10 attributes and struct[:attr] for big structs — funny.falcon@...
Issue #10585 has been updated by Yura Sokolov.
3 messages
2014/12/15
[#67126] Ruby 2.2.0 Released — "NARUSE, Yui" <naruse@...>
We are pleased to announce the release of Ruby 2.2.0.
8 messages
2014/12/25
[#67128] Re: Ruby 2.2.0 Released
— Rodrigo Rosenfeld Rosas <rr.rosas@...>
2014/12/25
I can't install it in any of our Ubuntu servers using rbenv:
[#67129] Re: Ruby 2.2.0 Released
— SHIBATA Hiroshi <shibata.hiroshi@...>
2014/12/25
> I can't install it in any of our Ubuntu servers using rbenv:
[ruby-core:66666] [ruby-trunk - Bug #10564] [Closed] DelegateClass, method_missing, and instance_eval -- different behavior in ruby 2.1
From:
matz@...
Date:
2014-12-03 23:34:18 UTC
List:
ruby-core #66666
Issue #10564 has been updated by Yukihiro Matsumoto.
Status changed from Open to Closed
It's not a bug.
Delegator which is superclass of DelegateClass, is a subclass of BasicObject, not Object, so that those delegation objects does not respond to methods defined in Kernel module, that means lambda etc. are not available in the instance_eval block (where the receiver is Delegator).
Matz.
----------------------------------------
Bug #10564: DelegateClass, method_missing, and instance_eval -- different behavior in ruby 2.1
https://bugs.ruby-lang.org/issues/10564#change-50275
* Author: jonathan rochkind
* Status: Closed
* Priority: Normal
* Assignee:
* Category:
* Target version:
* ruby -v: 2.1.3p242
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
This is an odd one, I don't completely understand. But there is different behavior in ruby 2.0 vs 2.1, and the 2.0 behavior is what I'd expect. Not sure if it's a bug, expected difference in behavior, or something else.
Here is a minimized reproduction:
~~~
require 'delegate'
class DelegateWithMethodMissing < DelegateClass(Object)
def method_missing sym, *args, &block
if sym == :lambda
Kernel.raise Exception.new("Why is it catching lambda?")
end
Kernel.puts "Caught method missing for `#{sym}` with args: #{args}"
end
end
o = DelegateWithMethodMissing.new( Object.new )
o.instance_eval do
missing_method "value"
missing_method_with_lambda_value lambda {|a| a}
end
~~~
On 2.0.0p576, this produces:
Caught method missing for `missing_method` with args: ["value"]
Caught method missing for `missing_method_with_lambda_value` with args: [#<Proc:0x007fa8532b3330@./spec/confstruct/test.rb:19 (lambda)>]
On 2.1.3p242, this instead raises the exception:
Caught method missing for `missing_method` with args: ["value"]
.test.rb:7:in `method_missing': Why is it catching lambda? (Exception)
Somehow the `lambda` inside the `instance_eval` is being caught by `method_missing`, instead of accessing the ordinary lambda keyword. If I remove the `method_missing` definition, then `lambda` can work as expected again, which is even more confusing.
--
https://bugs.ruby-lang.org/