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

The case for \.

Thread Next
Brent Dax
August 16, 2001 19:13
The case for \.
Message ID:
(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
(Do not reply to this Hotmail address--I'm using it temporarily.)

Get your FREE download of MSN Explorer at

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About