Closed yui-knk closed 10 years ago
This is related to #45.
In drb if proc is given, proc is wrapped with DRbObject. In this case defined? proc.call is not delegated to proc self. But proc.respond_to? :call is delegated to proc self.
defined? proc.call
proc.respond_to? :call
in console A
$ irb -r drb/drb irb(main):001:0> DRb.start_service => #<DRb::DRbServer:0x007fc4d9186758...> irb(main):003:0> there = DRbObject.new_with_uri('druby://localhost:12345') => #<DRb::DRbObject:0x007fc4d914ac08 @uri="druby://localhost:12345", @ref=nil> irb(main):004:0> there.class => DRb::DRbObject irb(main):005:0> there[:proc] = proc{} => #<Proc:0x007fc4d99bb5e0@(irb):5>
and console B
$ irb -r drb/drb irb(main):001:0> front = {} => {} irb(main):003:0> DRb.start_service('druby://localhost:12345', front) => #<DRb::DRbServer:0x007faec318a0c8...> irb(main):004:0> front => {:proc=>#<DRb::DRbObject:0x007faec317df08 @uri="druby://hoge.local:55573", @ref=70241720589040>} irb(main):005:0> front[:proc] => #<DRb::DRbObject:0x007faec317df08 @uri="druby://hoge.local:55573", @ref=70241720589040> irb(main):006:0> front[:proc].respond_to? :call => true irb(main):007:0> front[:proc].call => nil irb(main):008:0> defined? proc{}.call => "method" irb(main):010:0> defined? front[:proc].call => nil irb(main):011:0> prc = front[:proc] => #<DRb::DRbObject:0x007faec317df08 @uri="druby://hoge.local:55573", @ref=70241720589040> irb(main):012:0> defined? prc.call => nil irb(main):013:0> prc.respond_to? :call => true
so, https://github.com/luislavena/rb-readline/blob/v0.5.1/lib/readline.rb#L92-L94 dose not work. I will send PR to rb-readline.
This is related to #45.
In drb if proc is given, proc is wrapped with DRbObject. In this case
defined? proc.call
is not delegated to proc self. Butproc.respond_to? :call
is delegated to proc self.in console A
and console B
so, https://github.com/luislavena/rb-readline/blob/v0.5.1/lib/readline.rb#L92-L94 dose not work. I will send PR to rb-readline.