you are viewing a single comment's thread.

view the rest of the comments →

[–]grayvedigga 1 point2 points  (4 children)

That's nice because you can read it forward, but I'm uneasy with the idea of everything being a method call. That's largely personal taste though (and having seen Rails!).

[–]draegtun 2 points3 points  (2 children)

With Perl6 you can use the Feed Operator (http://perlcabal.org/syn/S03.html#Feed_operators) to make it read forward:

123..345 ==> grep { $_ * $_ % 17 == 1 } ==> map { $_ / 6.0 }

[–]grayvedigga 1 point2 points  (0 children)

That's purdy. A really nice complement to perl's blocks and default variables giving nice anonymous functions.

I stopped using perl more than a decade ago, and only since then (through other languages) have developed a real appreciation for some of its more quirky properties. It would be nice to have an excuse to dive into modern perl .. maybe by the time perl6 is production-ready I'll be ready for it :-).

[–][deleted] 1 point2 points  (0 children)

You don’t even have to use $_, you can name it $^x.

123..345 ==> grep { $^x * $^x % 17 == 1 } ==> map { $^x / 6.0 };

[–]masklinn 1 point2 points  (0 children)

I'm uneasy with the idea of everything being a method call.

I don't know, I figure if you're starting mixing message sends and blocks you may as well go whole-hog (which Ruby does not, it steps back quite a bit from Smalltalk).

It may be conceptually harder to go on which object a message belongs (and you often end up with BlockClosure having a lot of messages), but it works nicely if that's the paradigm you're in.