develooper Front page | perl.perl5.porters | Postings from May 2015

The null pattern design mistake

Thread Next
From:
Aristotle Pagaltzis
Date:
May 31, 2015 13:44
Subject:
The null pattern design mistake
Message ID:
20150531134431.GB76064@plasmasturm.org
In-Reply-To: <rt-4.0.18-32227-1431390545-1599.124368-15-0@perl.org>

* Tony Cook via RT <perlbug-followup@perl.org> [2015-05-12 02:30]:
> Or we could take /$null/ meaning 'use the last match' out the back and
> bury it.

Having the empty pattern mean “use the last matched pattern” is a fine
convention for a text editor, which is where it came from. But at least
since regexp objects (qr//) were added to Perl, there has been a way to
explicitly refer to patterns as first-class values. With that given, the
right peg to hang this feature off of is a ${^LAST_MATCHED_PATTERN} (or
whatever it be called), as opposed to a special case in pattern syntax.

I would really like to see that happen eventually.

It’s going to require a long deprecation cycle. But fortunately this is
a case where the replacement can be introduced before the bad design is
phased out, which allows a graceful roll-over with a long lead time.

Regards,
-- 
Aristotle Pagaltzis // <http://plasmasturm.org/>

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