thx, ikegami these are pretty much all the tests I already ran. 8-|

I think it's an old optimization feature that got dropped/lost, without updating the docs.

If anyone has access to a fairly old perl5 version, it would be nice to know what these test produce... He doesn't need to use B::Concise, it's documented that redefining a "constant function" always has to give a warning!

so plz, just run this code, and check for a warning:

no warnings; my $lex = 4; # file scoped lexical #--- normal # inner scope sub with_proto () { my $lex } # outer scope { my $lex = 4; sub with_proto() { $lex } } # file scope sub with_proto() { $lex } #--- reference # inner scope sub with_proto() {\ my $lex } # outer scope { my $lex = 4; sub with_proto() {\ $lex } } # file scope sub with_proto() {\ $lex } #------ lvalue #--- normal # inner scope sub with_proto() :lvalue { my $lex } # outer scope { my $lex = 4; sub with_proto() :lvalue { $lex } } # file scope sub with_proto() :lvalue { $lex } #--- reference # lvalue references are not feasible, because of # "Can't modify single ref constructor in lvalue subroutine" #------ overriding constant function throws always a warning sub with_proto () {4} # uncommenting garanties a warning # sub with_proto () {5}

Cheers Rolf


In reply to Re^2: Inlining a "lexically-scoped scalar which has no other references" by LanX
in thread Inlining a "lexically-scoped scalar which has no other references" 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!
  • 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.