Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
go ahead... be a heretic
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

I find co-routines useful, especially as filters or as generators for use in a loop.   But their internal implementations can be ugly.   While it would be nice to have them in this language, “there’s more than one way to do it.™”   As BrowserUK says (in so many words), I would not disabuse the Perl-5 language in order to do it in just this way.

For example, there are already closures in Perl ... the “coderefs” that were mentioned ... and these can be used to implement finite-state machines (FSMs) which will return a particular value each time they are called.   Presto, you have accomplished the intended effect, using the ordinary facilities that this programming language already offers you.   No, it’s not exactly the same thing, but a well-written implementation is clear.   Bloom where you are planted.

Anyhow, there are other threads on this, like Coroutines in Perl from back in 2004 ... and I can’t help but notice that, even “way back then,” the Perl-6 / Parrot people were telling us all how good it was going to be.   Someday.   ;-)


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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others meditating upon the Monastery: (11)
    As of 2014-04-16 12:07 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      April first is:







      Results (425 votes), past polls