develooper Front page | perl.perl6.language | Postings from May 2006

Re: A rule by any other name...

Thread Previous | Thread Next
From:
Daniel Hulme
Date:
May 11, 2006 08:22
Subject:
Re: A rule by any other name...
Message ID:
20060511152154.GA5514@istic.org
> >Including :skip(/<someotherrule>/). Yes, agreed, it's a huge
> >improvement.  I'd be more comfortable if the default rule to use for
> >skipping was named <skip> instead of <ws>. (On IRC <sep> was also
> >proposed, but the connection between :skip and <skip> is more
> >immediately obvious.)

> Yes, I like <skip> too. I too keep mistakely reading <ws> as
> "WhiteSpace".

For another datapoint, I like the idea of "<wb>" as word-boundary. After
all, when you're tokenizing input, you're interested in the boundaries
that separate tokens rather than the whitespace or what you do with it.
Although I like the connection between <skip> and :skip, <skip> to me
isn't very suggestive, and <ws> sounds too much like whitespace. <wb>,
to me at least, is reminiscent of \b, and of Vim's \< \> for word
boundaries.

I'm sure I'll get used to whatever the final name is, though; just
wanted to spread ideas. There are, to my mind, two ways of looking at
whitespace:

1) Whitespace in regexes is ignored other than to delineate tokens in
the regex. :skip() defines which characters in the input string are
skipped over by the matcher (regex engine, whatever you want to call
it).

2) Whitespace in regexes is significant. :skip() defines the meaning of a
block of whitespace in the regular expression.

AFAICS, both these states of mind come out to the same thing in the end
(someone correct me if I'm wrong), but the naming scheme makes much more
sense if you are thinking about it the first way.

-- 
"For God's  sake,  please give it up.  Fear it no less  than the sensual
passion,  because it, too,  may take up all your time and deprive you of
your health, peace of mind and happiness in life."      Wolfgang Bolyai,
urging  his son  to  give up  his  research  on  non-Euclidean  geometry


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