At 5:21 PM -0700 4/14/05, Larry Wall wrote:
In writing some character class translation, I realized that
    <-[a-z]>
and its ilk are rather hard to read because of the two hyphens
that mean different things.  We can't use <![a-z]> because that's a
0-width lookahead.  Given that we're trying to get rid of special
exceptions, and - in character classes is weird, and we already
use .. for ranges everywhere else, and nobody is going to put a
repeated character into a character class, I'm wondering if
    <-[a..z]>
should be allowed/encouraged/required.  It greatly improves the
readability in my estimation.  The only problem with requiring .. is
that people *will* write <[a-z]> out of habit, and we would probably
have to outlaw the - form for many years before everyone would get
used to the .. form.  So maybe we allow - but warn if not backslashed.
Larry

I don't see why the old syntax has to be supported at all.

Lots of other regexp details are already being changed, such as the bounding '<>' and the removal of the leading internal '^', so people already have to edit their regexps. So they can replace the '-' too while they're at it; not very difficult.

Moreover, I often create character classes that have a literal '-' in it, and it would be nice to not have to make that the last character in the class for it to parse properly.

Also, the '..' is easy to learn because it is consistent with other parts of Perl 6. Likewise, the consistency is another plus when demonstrating what is good about Perl to folk who don't use it.

-- Darren Duncan

Reply via email to