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

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

Thread Previous | Thread Next
From:
Yuki Kimoto
Date:
July 11, 2022 01:42
Subject:
Re: Pre-RFC: ${^ENGLISH_NAME} aliases for punctuation variables
Message ID:
CAExogxOtAcCZGt9FehPNWvtjeG7WR0k+eh-Z=+_hvnNO2ZbM6Q@mail.gmail.com
2022-7-9 6:31 Paul "LeoNerd" Evans <leonerd@leonerd.org.uk> wrote:

> 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
>
>
Oh, it is not so easy. Leon seems to have some problems in the stab
implementation.

Softref maybe means symbolic reference.

I changed the question.

Is the alias of the predefined variable the same as the alias such as
"$var" in  "for my $var (...)"?


> > 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.
>
>
I'm thinking of the problem of *quantity* when I implement them because
predefined variables are too many.

1. RFC-X1 Some part of them
2. RFC-X2 All.

>  > > 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).
>
>
>  I should clarify:
>
>  Yes, the brace is required.
>  No, $^INPUT_LINE_NUMBER is not allowed.

OK. I understand "$^INPUT_LINE_NUMBER is not allowed".

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