develooper Front page | perl.perl5.porters | Postings from December 2019

Re: Aliasing and Read-only variables

Zefram via perl5-porters
December 3, 2019 12:30
Re: Aliasing and Read-only variables
Message ID:
I wrote:
>usage you're proposing has nothing at all to do with typeglobs, so the
>association with the glob sigil is misleading.  It also might interfere
>a bit with any future work to process actual typeglobs in signatures.

Thinking about it more, I find the case compelling to avoid using
any sigil character as a prefix meaning anything other than the sigil.
But I agree with a prefix character for this aliasing use being superior
to a postfix (though not for your reason).

I suggest that "=" would be a better prefix character, mnemonically
suggesting a stronger-than-usual equality between the argument and the
parameter variable.  In assigning that character I'm assuming that "="
wouldn't be used for the pair-constructor shorthand (because of the POD
clash) and therefore also wouldn't be used for named-parameter shorthand
in signatures.  However, making it possible to have "=" at the start
of a signature item invokes a milder version of the POD clash that I
described in respect of pair shorthand.  It's milder because this isn't
letting an actual expression begin with "=", and therefore isn't letting
a *statement* begin with "=".

If "=" is somehow ruled out for this purpose, there are many options
of weaker mnemonic value that are about as good as each other.  "+"
is probably my second favourite.

-zefram Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About