There would be a collision issue if you had both a hash and an array with the same name, but since this happens mostly because of a bad coding style, or as a mistake, I suppose that's only half an issue. And you could always overload the operators to make your scalar act like a reference to any other type.

In the end, your proposition is just a trick to emulate the sigil invariance of perl 6 isn't it? That's the main issue I think. It would make people coming from other languages (php would definitely be an issue) think they understand what's happening when you write my $array = ["Hello", "World"]; print $array[0];. And it would hide away most notions of list from perl because you could work with a subset of the language that only handles scalars, without any indication in the syntax that thing are not what they seem. If people coming to perl from other languages start using that feature because it makes perl "act normal", the @ sigil would mostly be understood as giving the size of the array, with bugs sometimes appearing when people use it in list context without understanding what list context is.

Maybe if the scalar associated with @array was $array_ref, or some other change that makes it clear that $array[0] is not just a shortcut for $array->[0] that would be OK, but then maybe the extra -> isn't too much pain. And even then I think associating variable on an individual basis instead of an automatic one would be better, bind (my $array_ref => my @array); if my @array; my $array_ref = \@array; is too cumbersome for you (I tried, bind my ($array_ref => @array) doesn't work with prototypes).

Edit: turned my nearly one-paragraph-long sentence into multiple ones, mostly by adding dots :)


In reply to Re: Unifying namespaces of @name and $name to simplify dereferencing? by Eily
in thread Unifying namespaces of @name and $name to simplify dereferencing? 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.