Jeremy Zawodny <[EMAIL PROTECTED]> writes:

> On Thu, Dec 13, 2001 at 07:00:19PM -0500, Jeff 'japhy' Pinyan wrote:
>> On Dec 13, Ryan Fischer said:
>> 
>> And it's not an obscure use NOR an abuse of the function.  The fact that
>> tr/a-z// replaces the empty replacement list with a-z is SPECIFICALLY
>> documented, and the use of this for counting characters is SPECIFICALLY
>> suggested.
>
> The fact that it is documented doesn't change that fact that it's
> obscure.  (I wish more people understood that.)  I suspect that many
> of the folks who frequent this list have been wearing their Perl
> blinders long enough that it doesn't just doesn't *seem* obscure
> anymore.
>
> Think back to when you were first learning Perl.  Or regular
> expressions.  They're documented but you still find yourself thinking
> "damn, this is obscure..."  Are you wrong?

I never found myself thinking 'damn this is obscure' at any point
while I was first learning perl. Most of the time I found myself
thinking 'coo, this is a better way of doing <whatever> isn't it?'.
Especially the regular expressions. You have to remember that, for
those of us who came to perl from earlier unix tools, perl's way was
often a model of clarity and power. When you already know regular
expressions from sed/grep/awk, then perl's regular expressions aren't
obscure, they're utterly fantastic. When I reached the documentation
for tr///, my reaction was 'What a neat idea'.

And I can't say I found myself thinking 'damn this is obscure' when I
first learned about regular expressions. Okay, so they don't work like
shell globbing, which is why I was puzzled when I *saw* my first
regex. But as soon as I started to read the documentation they
revealed themselves as a really clean and remarkably straightforward
notation for expressing (potentially) complex matching rules.

I've read regular expressions that took some time to understand, yes,
but claiming that regular expression syntax is 'obscure' because, say
/"((?:\\.[^\\"]*|[^\\"]*)+)"/ is hard to understand is akin to
claiming that English is obscure because 'O Rose thou art sick!...'
is a hard poem to understand. (Not that I'm equating the foregoing
example of premature optimization with the work of one of the great
English poets)

-- 
Piers

   "It is a truth universally acknowledged that a language in
    possession of a rich syntax must be in need of a rewrite."
         -- Jane Austen?

Reply via email to