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

Re: JWZ on s/Java/Perl/

January 29, 2001 09:14
Re: JWZ on s/Java/Perl/
Message ID:
Jeanna FOx wrote:
> Everybody seems to be missing the fact that jwz bitching about Java's
> "32 bit non-object ints" means that at least he thinks they could be
> salvaged. What would he think of Perl's "224 bit non-object ints"?!
> Don't get smug because Perl can iterate over an array of anything. The
> price we pay is incredibly expensive.

Personally, my big complains about Java are about having to write

    [  Object a; int b;  ]

    a = new Integer(b);
    b = ((Integer) a).intValue();
    // ...or something like that

    ** instead of **

    a = b;
    b = a;
    // this is perlish!!!

Well, if a compiler can't figure it out that the types of the
variables "Object" and "int" are different and it should make 
a conversion to assign one from the other, well, then the 
compiler writers are damn bad programmers! If the int takes 
32 bits, 64 bits, 224 bits, or even 64K, that's an issue of 
memory usage, and that could be handled differently (and
transparently) by different implementations of the VM. Perl6 
will probably be such a case. As it will (probably) run under 
JVM, .NET and native, the sizes of "int" will probably be 
different under the 3 architectures. What matters is that 
the functionality is preserved.

> P.S. I may be wrong, but trying to learn what jwz doesn't like about
> Java and then figure out how to "fix" it in Perl is an impossible task.
> He's got wonderful, interesting, thoughtful opinions -- they just seem
> contrary to Perl's basic existence.

I agree completely. Java is a systems programming language, 
i.e. it's a very low level language. (You may disagree with 
me, but Java is just as low level as C, and, as far as UNIX 
is concerned, it's much less portable, IMO.) Perl, on the 
other side, is a scripting language, i.e. high-level. Perl
should be concerned with things as weak-typing, lists that
grow and shrink as we wish it, hashes, auto-converting 
int's to bigint's, regexp matches, closures, and this kind
of things that are very abstract (to a machine) and that
make programming Perl so great, simple and creative!

About jwz's "I think java has enough of the lisp nature to
satisfy me, even though it's not a purely functional language":
WHAT??? IS THIS GUY SERIOUS??? Java has nothing of a 
functional language!!! There is no such thing as a function
pointer (or anything equivalent) in Java. The closest you
can get is an annonimous inner class, that was almost like
an improvised patch. And the verboseness!!! You have to write
two sets of { } and still having to use an interface only
for a closure!!! Well, the other thing about lisp, besides
functions, are lists. And there's no thing Java handles worst
than lists. Arrays [] are static (what is dumber than dumb!)
and Vector's send strong-typing to the space!!! And try to
make a list of int's with Vector. The bad syntax I was talking
about before goes even worst:

    [ Vector v; int i; ]
    v.addElement(new Integer(i));        // push @v, $i;

    while (v.hasMoreElements()) {
        i = ((Integer) v.nextElement()).intValue();
    //  foreach $i (@v) {  do_something_with($i)  }
    //    ** or shorter **
    //  map { do_something_with($_) }, @v;
    //    ** there's much more than these ways to do it **
    //  do_something_with($_) for @v;
    //    ** and so on **

About jwz's "I despise C++ and perl": Well, I even can
understand despising Perl. Some people feel threatened
and obfuscated by a language that has a personality,
yet one that has such a bright and clever one ;-)
But "C++ just makes everything harder and worse, so 
I won't use it at all.", I actually agree, but not to
the extents he goes about it. I actually didn't read 
it, but I guess he means he prefers Java to C++. This
point I disagree. Of course, C++ has no GC, which is a
good thing, but you can always fake it with Refcounts,
which is much more efficient, and easily feasable with
C++. And at least they didn't chop from you templates 
and operator overloading, which could do Java a usable
thing. At least I could then have a list of integers,
instead of the verbose code above!

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