Florian Gro? wrote:
> Trans wrote:
>
> >>True, this is not possible just yet, but C# 2 already introduced
> >>features like yield return and delegate(int x) { return x * 2; } that
> >>are a huge step away from the simple mindedness of Java.
> >
> > Had to do it.
> >
> > require 'blankslate'
> >
> > class Delegate < BlankSlate
> >   def initialize( obj, &yld )
> >     @obj = obj
> >     @yld = yld
> >   end
> >   def method_missing( sym, *args, &blk )
> >     if @yld
> >       @yld[ @obj ].__send__( sym, *args, &blk )
> >     else
> >       @obj.__send__( sym, *args, &blk )
> >     end
> >   end
> > end
>
> Careful! C# delegates don't actually delegate messages. Instead they are
> the closest thing to Ruby's blocks the language has right now. Not sure
> why they named them that way, but it's probably related to the
> implementation.

Oh, is that all? Where've they been these last years? ;-)

T.