let's try a proposal as thought experiment and discuss it


short version:*


1. Any assignment to an undeclared new variable implies a "implicit" my when in

2. explicit my are still optionally allowed, our and state keep their semantics

3. No hoisting, a variable accessed before an implicit my still belongs to the upper scope and needs to be declared there

4. loop-bodies and naked blocks (technically the same) follow the old rules

5. ( ??? ) nested/anonymous subs are tricky, when it comes to closed over vars

6. ( ??? ) functional blocks like in map {BLOCK} are technically anonymous subs ° 7. ( ??? ) class-variables are a current issue in proposed new OOP models.

8. special global vars are exempt from implicit my.

9. Last but not least automine activates strict

So ...

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

°) actually not in the case of map and grep but for all of List::Util , try return to see the difference

*) updated


In reply to Re^4: A short whishlist of Perl5 improvements leaping to Perl7 (Thought Experiment No.1) by LanX
in thread A short whishlist of Perl5 improvements leaping to Perl7 by rsFalse

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.