develooper Front page | perl.perl5.porters | Postings from March 2021

Re: Perl feature wish: quote-word array-ref operator

Thread Previous | Thread Next
From:
Smylers
Date:
March 5, 2021 16:18
Subject:
Re: Perl feature wish: quote-word array-ref operator
Message ID:
20210305161816.GM285759@stripey.com
Paul "LeoNerd" Evans writes:

> On Fri, 5 Mar 2021 15:28:01 +0100
> Graham Knop <haarg@haarg.org> wrote:
> 
> > perl -e'use strict; sub qa {} sub one {} sub two {} sub three {}
> > qa[one two three]; print "works\n"'
> > works
> > 
> > It's currently valid syntax. A feature flag would be necessary.
> 
> I wonder if perl core should suggest that all two-letter q?-named
> functions are in fact at least reserved for future syntax?

How would that help, in terms of not breaking backwards compatibility?

If somebody already has a working system with a function legitimately
called qa(), P5P retrospectively ‘reserving’ it doesn't mean much: it
wasn't reserved when they wrote it, so it's imposing a backwards
compatible change on them.

However, I would love a qa[one two three] operator. Putting it behind a
feature flag is fine — so long as v5.42 (or whatever) enables it, it
won't be necessary to type the feature flag in full to make use of it
and retain backwards compatibility.

Smylers



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