[geeks] Misuse of Java

David Cantrell david at cantrell.org.uk
Wed Nov 6 16:09:53 CST 2002


On Wed, Nov 06, 2002 at 04:24:17PM -0500, Joshua D Boyd wrote:
> Now, I'm know that other languages have some of the things I complain
> about perl for.  However, they usually offer something perl doesn't,
> namely speed in C/C++.

But then perl has advantages over those other languages in other areas.
Choose the right tool for the job.  If you need to crunch numbers fast
then I agree, C is best.  Or maybe Forth :-)  If you need to talk to
hardware, C is best too.  In fact, if you look at quite a few of the
more mathemagically-oriented perl modules, you'll find that they are
written in C with a perl wrapper.

> Now, my complaints about perl start with all the built in things that
> have side effects and different names.  I mean, come on:
> while (<>) 
>       $_ ....

... which is discouraged for use in anything other than a throw-away script.
In code which I might have to maintain next week, I'd write something more
like ...

while(my $scalarvariable = <FILEHANDLE>) {
	...

> How is the sane person supposed to connect <> and $_ together?

The same way that people are meant to understand the meaning and inter-
relatedness of * and & in C, or the difference between = and ==.  By
learning the language.

> Also, I find parameter passing between functions to be amazingly insane,

If you mean pass-by-reference, then I beg to disagree.  There are times
when that's actually quite useful.  The recommended idiom makes that go
away anyway

> and I think too much stuff is built in that should instead be an easy to
> use object of some sort.  Like Regexs, much of the posix stuff, etc.

Perl was originally designed to be a tool for munging text easily.  That's
still its forte.  That's where the built-in pattern matching comes from.
It offers the advantage that, unlike in some other languages, you don't
have to contend with seventeen subtlely incompatible implementations*.  As
for the posix stuff - if you refer to the extensive list of functions for
getting at native system calls, then they're nothing more than wrappers
around the same functions in the standard C library.  Otherwise, to get
posixy stuff, you need to use the POSIX module which, whilst supplied as
part of the perl 5.8.0 package, is not used by default, you have to
explicitly pull it in to your program.

FWIW, I think that the 5.6.1 and 5.8.0 distributions are far too big, a
lot of the modules that are supplied as standard should be left out.

* - a problem which perl suffers from in other areas of course

-- 
David Cantrell | Member of the Brute Squad | http://www.cantrell.org.uk/david

      Good advice is always certain to be ignored,
      but that's no reason not to give it            -- Agatha Christie



More information about the geeks mailing list