I object to this wording. You can't have an alias to something that doesn't exist. What is really happening is that, in older Perl, passing a member of an aggregate (an array element or a hash value) forced it to be created so that it could be aliased and the alias put into @_ (because sub call arguments are an lvalue context just like other lvalue context that might not actually change the variable you place in them). In this new Perl, instead a "magic" scalar is created and modifying this magic scalar will cause a new scalar to be inserted into the aggregate (if not already inserted by some other operation) and then cause the modified value to be copied over that member. At no point is this magic placeholder scalar an alias to the potential aggregate member (I bet).

I don't have a bleeding-edge Perl so I can't test, but I can already think of quite a few ways in which this change likely significantly modifies existing behavior (not to mention the ways in which it certainly modifies long-standing behavior). Nothing like throwing in some complex "magic" to break backward compatability and make really explaining lvalue context a lot more complicated for the sake of preventing a minor newbie surprise. And why, again, is it that we can't make <>'s use of @ARGV not be completely stupid? I guess doing so doesn't require enough complicated magic in order to make it appealing to p5p.

At least once in this documentation the term "alias" should be replaced with "magic 'alias'".

- tye        


In reply to Re: perlsub question.. ("alias"?!) by tye
in thread perlsub question.. by Anonymous Monk

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.