develooper Front page | perl.perl6.language | Postings from April 2005

should we change [^a-z] to <-[a..z]> instead of <-[a-z]>?

Thread Next
From:
Larry Wall
Date:
April 14, 2005 17:21
Subject:
should we change [^a-z] to <-[a..z]> instead of <-[a-z]>?
Message ID:
20050415002105.GA19046@wall.org
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

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