in reply to How would you fix Java?

Java's biggest strength is that its object system is probably the best of any commonly used language (i.e., one that is actually used, not just an academic oddity). The worst thing about Java is that it had better have a great object system, because you're going to be forced to use it no matter what.

Perl5's beggest weakness (IMHO), is that its object system is probably the worst of any commonly used language. It ain't pretty, but it gets the job done. It's not so bad for the applications programmers to use (what difference does it make if you say "$obj->foo()" instead of "obj.foo()"?), but it is an effort in kludginess for anyone developing new classes. Fortunatly, Perl doesn't force you to use its object system. You can write your program in a purely functional or procedural manner, too.

In fact, thanks to CPAN (probably the largest and best example of code reuse ever), many programs can rely on existing classes and therefore are so simple that anything but procedural just gets in the way.

For instance, I wrote CGI::Search for my current employer (who then graciously allowed it to be publically released) in order to simplify the many seperate search scripts on our web site. The example script shown in the synopsis for CGI::Search is a little over 100 lines and contains everything my employer needs for the vast majority of our searches. Most of those lines are just filling in data structures, and the exact size will depend on the complexity of the flat-file database that you're searching and the number of input parameters. Doing these scripts as anything but procedural is just taking up extra space without adding anything. In other words, the script itself is just a little glue to tie user input into an object.

I doubt Java will ever go the route where you can use it without declaring at least one class. It would be too much of a change from where it is now.

Keep in mind that although Java might be great for those really big problems, little problems tend to outnumber the big problems. Perl fills that space quite nicely.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated