develooper Front page | perl.perl5.porters | Postings from August 2001

The case for \.

Thread Next
From:
Brent Dax
Date:
August 16, 2001 19:13
Subject:
The case for \.
Message ID:
F94nGQlQ3uGF3IzlBIY0000e275@hotmail.com
(Note that I am not necessarily advocating \. over other syntaxes--I'm fine 
with forms such as \?.)

Many people here who originally advocated \. seemed to be placated when the 
"typeclass syntax" (for lack of a better term) was proposed.  They feel that 
(\[$@%*&]) is just as good as (\.).

*Come on!*

\. and typeclasses are not mutually exclusive.  In fact, \. could just be a 
shortcut for \[$@%*&].  Many will argue that this syntax is redundant and 
unnecessary.  I see it a different way: this is a shortcut, something we 
provide often in Perl.

When someone is writing a regexp, we don't make them write [^\n] for "any 
character"--we provide dot.  (And we provide the /s switch for the common 
case where you *really* want to match "any character", instead of requiring 
a [\0-\377].)  We don't require them to jump through hoops for other common 
patterns--we provide \w, \n, \s, and many other shortcuts.  Even when you 
want to search through an array, we don't require a foreach like 
god-knows-how-many other languages--you can just use grep.

Perl is all about streamlining programming, and one of the big ways it does 
so is by providing shortcuts.  If \[$@%*&] is a common case, we should 
provide a shortcut.

--Brent Dax
brentdax@cpan.org
(Do not reply to this Hotmail address--I'm using it temporarily.)

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp


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