develooper Front page | perl.perl5.porters | Postings from January 2023

Re: Making s:foo:bar: warn "reserved" - contentious idea?

Thread Previous
From:
Branislav ZahradnĂ­k
Date:
January 14, 2023 19:29
Subject:
Re: Making s:foo:bar: warn "reserved" - contentious idea?
Message ID:
CAB=rbOmd62bvesPPMmFWUyrUOPvNvqcn-XbYcaGS7aKs0GcU1A@mail.gmail.com
On Sat, 14 Jan 2023 at 15:40, Paul "LeoNerd" Evans <leonerd@leonerd.org.uk>
wrote:

> I have a longterm thought that one day it'd be nice if we could have
> more, and more descriptive, string quoting and regexp flags - especially
> on substitutions. For example, I'd love to be able to replace only the
> third "foo" with "bar" by doing something, maybe using syntax like this:
>
>   $str =~ s:nth(2)/foo/bar/;
>
>
what about making these attributes attributes of operator instead? eg:
$str =~ :nth(2) s:foo:bar:;

Anyway, +1 for warning and future deprecation, it will get rid of some
confusions making lexers / parsers more complicated, eg:
package m { sub x { die } };
m::x;

Thread Previous


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