http://qs321.pair.com?node_id=1029931


in reply to Re: RFC: Simulating Ruby's "yield" and "blocks" in Perl
in thread RFC: Simulating Ruby's "yield" and "blocks" in Perl

> (on the interpreter-level - not via (sorry) ugly hacks like your "yield").

Backwards compatibility is always an issue when discussing new features.

Ugly hacks which work (even slowly) for old Perl versions improve the acceptance of new features.

And normally the "ugliness" would be hidden in a module, much like the code of the Perl interpreter isn't judged for prettiness.

update

> Are languages like Perl, Python, Ruby, Javascript not all "essentially" the same?

Nope!

Just to make it measurable:

The efforts needed for an experienced Perl programmer to learn Python are at least 10 times bigger than for Ruby.

It's because Ruby copied semantics and even names for operators and idioms deep into details. Old docs for Ruby still mentioned the strong Perl heritage.

And you might notice that a "ruby" is a gem and not a snake.

AFAIK the semantic influence of Python is basically the exception system.

update

To give a concrete example, the equivalent for an anonymous sub in Perl or a {block} in Ruby is a lamda in Python. But a lamda is restricted to at most one statement, with the effect that some functional idioms in Python look like a cluttered mess of nested lambdas.

update

Furthermore Python doesn't have variable interpolation in strings, you must use printf or similar replacement techniques.

Cheers Rolf

( addicted to the Perl Programming Language)