rtc icon indicating copy to clipboard operation
rtc copied to clipboard

Allow for function instantiation

Open jtoman opened this issue 13 years ago • 2 comments

It's possible to confuse our type inferencer for polymorphic methods. We should allow code like the following

my_object.rtc_instantiate("polymorphic_method", 
          :t => "Fixnum or String", :u => "A or :sym")[2, :sym]

jtoman avatar Oct 01 '12 22:10 jtoman

Unfortunately it is not possible to have a Proc or a lambda pass through a block. So you can't do something like this:

Proc.new {
   |a|
   yield a
}

This has major implications for our implementation, so any instantiated method could not accept a block. I'll look into ways to work around this.

jtoman avatar Nov 18 '12 03:11 jtoman

It now strikes me as incredibly obvious that we can implement our own "Proc" class that will pass along a block. We would implement the same api, and we may even consider inheriting from Proc so that is_a? and what not continue to work. I will start working on implementing this next.

jtoman avatar Nov 18 '12 19:11 jtoman