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

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

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
July 8, 2022 21:32
Subject:
Re: Pre-RFC: ${^ENGLISH_NAME} aliases for punctuation variables
Message ID:
20220708223151.56432a39@shy.leonerd.org.uk
On Sat, 9 Jul 2022 06:14:36 +0900
Yuki Kimoto <kimoto.yuki@gmail.com> wrote:

> I'm interested in this topic.
> 
> I have questions.
> 
> 1. Can this be resolved in tokenizer?
> 
> This means ${^INPUT_LINE_NUMBER} is replaced with $. in toke.c.

No. That's really the variable's name, as can be demonstrated via
softrefs:

  $ perl -E '"hello" =~ m/\w+/p; say ${^MATCH}; my $varname = "\cMATCH";
     say $$varname'
  hello
  hello

> 2. Is the brace required?
> 
> Is $^INPUT_LINE_NUMBER allowed?

Yes. $^ is already a variable on its own (a little-known part related
to formats).

> 3. Can only the aliases that are often used be added?
> 
> For example, in my experience. I use $., $/, $$, $@, $!, $<, $> etc.
> 
> If 1 and 3 are ok, I can write RFC.

I'm not sure what significance part 1 has on writing the RFC. That
feels like a purely implementation-level question.

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About