Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^2: RFC: Simulating Ruby's "yield" and "blocks" in Perl

by LanX (Bishop)
on Apr 22, 2013 at 17:12 UTC ( #1029931=note: print w/replies, xml ) Need Help??

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.


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


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.


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.


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)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1029931]
[stevieb]: I finally got all of my tests to run against my App::RPi::EnvUI!! I am so pleased :) Now to add more tests, update the documentation, some code cleanup, put in production in my largest operation, and do a non-beta release

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2017-12-16 00:10 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (446 votes). Check out past polls.