From: Mathieu Bouchard Date: 2002-01-03T12:25:40+09:00 Subject: [ruby-talk:30104] Re: Parrot (was re, Python and Ruby: a comparison) On Thu, 3 Jan 2002, Rich Kilmer wrote: > One issue is that Ruby's blocks carry with them the context of where they > were called so if you had this: > x = 2 > myObject.each { |p| puts p*x} > Is that possible with Parrot? Can your functions be defined with a local > scope of some context? It's been possible with Perl5 since the beginning (~1995). my $x=2; $myobject->each(sub{ my($p)=@_; puts($p*$x); }); but that is directly equivalent to: x=2 myobject.each proc{|p| puts p*x } because ruby is nearly the only language with a &-slot. ________________________________________________________________ Mathieu Bouchard http://hostname.2y.net/~matju