develooper Front page | perl.perl5.porters | Postings from September 2022

Re: Pre-RFC: ${^ENGLISH_NAME} aliases for punctuation variables

Ricardo Signes
September 23, 2022 15:14
Re: Pre-RFC: ${^ENGLISH_NAME} aliases for punctuation variables
Message ID:
On Fri, Oct 29, 2021, at 19:47, Dan Book wrote:
> Currently, each punctuation variable has an $ENGLISH_NAME alias available for readability. But this has a couple problems: it's only available if you "use English;" which does not provide a direct indication of the variables it's related to in the code, and was a significant performance penalty in older versions of Perl; these issues leading to not much use of the module and thus the knowledge of their existence has not become widespread; so average Perl programmers finding $CHILD_ERROR in Perl code are likely not to know it's an alias for $? or that it's a built-in variable at all, thus reducing its effective readability instead of increasing it.

This is in the RFC tracker at these days.

The blocker seemed to be the interaction between strict and these vars, since right now any ${^FOO} is permitted without declaration.

It sounds like the general consensus is that we can make "use strict 'vars'" affect this. So if you say `${^FOO}` and that's not one of Perl's global variables, it's fatal. We'll carve out an exception for FOO where FOO starts with an underscore.

Is that right?

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