in reply to Re: RFC: Simulating Ruby's "yield" and "blocks" in Perl
in thread RFC: Simulating Ruby's "yield" and "blocks" in Perl
In other words: Python has no chance to mimic this! (AFAIK)
my ($c_ref) =@_; $c_ref->(1);
When using idioms which heavily rely on passing code-blocks it's just a matter of huffman-optimization to abstract the repeated parts away.
I think you can't "see the use", because Perl doesn't use such idioms as often as Ruby does.
Without the performance penalty, I'd use it straight away.
(Keep in mind that many people ignore how slow Ruby is, for the sake of "pretty syntax")
I just read the first chapter of "7 Languages in 7 Weeks" which was a funny/shocking experience.
For instance it praised many features like post-fix if or unless which stem from Perl³ ... just as if Ruby invented it.²
Why not pirating some of the hype for us?
Ruby's success is about pretty syntax on Perl semantics. Ruby's success is still heavily shocking the Pythonistas, who believe that Guido is God's (= John von Neumann's?) last prophet.
(Moose showed how to cover the object model, covering the functional part closes the gap.)
But rather about b{ } being superfluous and expensive, while "easily" replaced by sub { } w/o performance loss.
Cheers Rolf
( addicted to the Perl Programming Language)
¹) "I'm every woman, its all in me" - Chaka Khan =)
²) Not talking about the strange and inflationary use of the term DSL within the Ruby community. If there is a mainstream language w/o Lisp's reader macros, which is predestinated to define DSLs, then it must be Perl. (Ok I don't know all maistream languages ... )
³) And are criticized in PBP! =)
|
|---|