S
SASADA Koichi
Hi all,
This is ruby-dev summary 24298-24353.
[ruby-dev:24302] Invoke Proc object with any method name
Nowake proposed that a Proc object should be invoked with
any method name like that:
m = Proc.new( :to_s ) { 'test1' }
p m.to_s # => 'test1'
This scheme is enabled with following code:
class MethodProc < Proc
def initialize( *method_name, &procedure )
super( &procedure )
m = Module.new
method_name.each do | i |
m.__send__( :define_method, i, &procedure )
end
self.extend( m )
end
end
He made a point that it is helphul that a Proc object can
be handled as polymorphic.
Matz amazed about this idea. This issue is still open.
# ruby-dev summary index:
# http://i.loveruby.net/en/ruby-dev-summary.html
See you at RubyConf2004.
Regards,
This is ruby-dev summary 24298-24353.
[ruby-dev:24302] Invoke Proc object with any method name
Nowake proposed that a Proc object should be invoked with
any method name like that:
m = Proc.new( :to_s ) { 'test1' }
p m.to_s # => 'test1'
This scheme is enabled with following code:
class MethodProc < Proc
def initialize( *method_name, &procedure )
super( &procedure )
m = Module.new
method_name.each do | i |
m.__send__( :define_method, i, &procedure )
end
self.extend( m )
end
end
He made a point that it is helphul that a Proc object can
be handled as polymorphic.
Matz amazed about this idea. This issue is still open.
# ruby-dev summary index:
# http://i.loveruby.net/en/ruby-dev-summary.html
See you at RubyConf2004.
Regards,