|Perl Monk, Perl Meditation|
Unifying namespaces of @name and $name to simplify dereferencing?by LanX (Cardinal)
|on Mar 22, 2016 at 11:53 UTC||Need Help??|
This is a meditation !
As a beginner one of my biggest obstacles with Perl was the duality of the list form @arr =(1,2,3) and reference form $arr_ref = [1,2,3] of data structures (same with %hashes )
see also Re: disadvantages of perl
I should choose references far more often, but I'm normally too lazy to always type the dereference operator -> , that's a breach in the paradigm of "making easy things easy"!
let's suppose we had a feature called use feature "autoref" (not sure about the best name)
and defining my @name would automatically involve defining my $name = \@name and vice versa (same with %hashes ).
This could simplify notation a lot.
I not only rarely have collisions between those namespaces, I actively avoid them (like using plural for array names).
Are there any pitfalls I didn't think of regarding this hypothetical feature?