Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Comment on

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

The pragma is supposed to be lexical? What would

@foo = map {use threadsafe; $_ = foo($_)} @bar;
mean then? Is the foo() to be treated as threadsafe or not? And can the block be paralelized?

Let's assume first that the {use threadsafe; ...} means that the contents of this block may be parallelized. No matter what subs do you call within. The programmer would have to be very very carefull then and it would take him ages to validate each and every subroutine that might get called. And the bigger the task (and thus the better candidate for parallel execution) the harder would it be to validate it. So I doubt people would use this often, if at all.

What about if the use threadsafe; mean just that the code in the block is threadsafe, but would not say anything about the subroutines. And the interpreter would be alowed to parallelize the execution only if also all subroutines used in the block are marked threadsafe. The problem then is ... who's going to mark them? And if I mark a subroutine threadsafe, does it mean I've just said even the subroutines called from within are threadsafe? What if the implementation of a subroutine I use from a module changes and it no longer is? Or does it mean that the compiler should check the threadsafety of the subroutines used within the one it just compiles and either die or warn and ignore the mark if it uses a subroutine that's not threadsafe? The second is of course much safer, but requires changes in other people's modules!

Jenda
We'd like to help you learn to help yourself
Look around you, all you see are sympathetic eyes
Stroll around the grounds until you feel at home
   -- P. Simon in Mrs. Robinson


In reply to Re: RFC: Implicit Parallelization Pragma by Jenda
in thread RFC: Implicit Parallelization Pragma by hardburn

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 rifling through the Monastery: (8)
    As of 2014-12-29 08:07 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (185 votes), past polls