develooper Front page | perl.perl6.language | Postings from January 2001

Re: JWZ on s/Java/Perl/

J. David Blackstone
January 27, 2001 16:16
Re: JWZ on s/Java/Perl/
Message ID:
>    o The architecture-interrogation primitives are inadequate; there is no
>      robust way to ask ``am I running on Windows'' or ``am I running on
>      Unix.''
>         **We have $^O, but it requires parsing every time**

  And $^O =~ /win/i broke recently when Apple introduced Darwin.
(Riddle me this, Batman: when does a Macintosh look like Windows?)

>    o And in related news, it's a total pain that one can't iterate over the
>      contents of an array without knowing intimate details about its
> contents:
>      you have to know whether it's byte[], or int[], or Object[].

  <big grin>  That's one nice thing about Perl; you can foreach over
an array of all sorts of different things.  In fact, being able to
just have an array of all sorts of different things is something Perl
still has over Java, C, and the like.

  In Java's favor, one might mention that if you're going to iterate
over an array of objects that aren't the same, they should probably
all implement a common interface if you expect to do anything useful.
But it's nice to have the ability to do anything if you Know What
You're Doing.

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