Re: Brainstorming: quoted identifier operator

[email protected] ("Philippe Bruhat (BooK)")
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
On Wed, Jan 07, 2026 at 12:22:47PM +0100, Christian Walde wrote:
> On 07/01/2026 12:16, Dave Mitchell wrote:
> > On Wed, Jan 07, 2026 at 10:56:03AM +0100, Branislav Zahradník wrote:
> > > just another idea based on my everyday work - let's defined new quoting
> > > operator: quoted identifier.
> > ...
> > 
> > You don't say what this quoting operator actually does.
> 
> The proposed example is:
> 
> sub qi (this is nicely readable test name) {}
> 
> This tells me the intent is to be able to declare sub names similar to how
> prototypes are handled, i.e. with literally anything in them.

How would the sub be invoked, though?

Like this?

  qi(this is nicely readable test name)( @args )

Surely not this, right?

  qi(this is nicely readable test name)->( @args )

We already have syntax for declaring and calling subs with unusual names:

    no strict 'refs';
    *{"some readable name"} = sub { say "foo" };
    &{"some readable name"}();

The fact it doesn't look so great might actually be a good thing...

Identifiers are everywhere, including variables, does that mean we could
do this?

  $qi(my favorite variables have long, descriptive names)

Also, as far as I know, the only variables names that do not have to be
proper identifiers are package variables (because of the way packages
work), no? Which means this wouldn't work for lexical variables.

Also, would qi interpolate?

-- 
 Philippe Bruhat (BooK)

 People are all unique- but some are more unique than others.
                                    (Moral from Groo The Wanderer #22 (Epic))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.