Re:AWK-ward Ruby
by gte910h on Tuesday April 26, 2011 @01:47PM
(#2486340)
Blocks come from smalltalk too: http://web.cecs.pdx.edu/~harry/musings/SmalltalkOverview.htm...
[ Parent
| on HN ]
Re:AWK-ward Ruby
by flatwhatson on Tuesday April 26, 2011 @11:01PM
(#2488199)
Blocks are also available in Perl, in the form of anonymous subroutines. They follow Perlish conventions for argument handling (rather than having a neat inline syntax like Smalltalk or Ruby), but they're most definitely the same thing!
my $block = sub { say "w00t, blocks!" };
my $closure = sub { $block->(); say "w00t, closures!" };
You'll have to look further for something Ruby does that Perl doesn't :)And in Perl6 you can drop the sub bit:
my $block = { say "w00t, blocks!" };
And there are also pointy blocks for neater stuff: my $pointy_block = -> $text { say "$text, blocks" };
$pointy_block("ne@t");Yeah, smalltalk blocks are almost identical to ruby blocks.
Article just acted like that was a ruby invention (which they corrected)
My comment had nothing to do with perl.
Re:AWK-ward Ruby
by flatwhatson on Wednesday April 27, 2011 @01:17AM
(#2488486)
I probably should have replied to rtomayko's comment rather than your own. I'd edit the tree, but it's immutable!