Which was the first dynamic language on the JVM? Think you know? Read on!
/* This is a fully documented program */
say 'Hello World!'
In 1995 the NetRexx language was conceived by Mike Cowlishaw of IBM. We have an exact birthday – it was the 10th of December, 1995. Consequently, NetRexx is 17 years old, and this fact makes it the oldest alternative language for the JVM. Mike was involved in porting the Java VM to IBM’s platforms – and the first platform to receive a JVM was OS/2. No blog has enough space to lament OS/2 and the fate that is has met by IBM’s shabby treatment of its own intellectual property and Microsoft’s insincere stance – OS/2, the most important program for the future, does one remember?
Experience shows that it does not help crying over spilled milk, but a straight headed analysis shows that NetRexx and its ancestor Rexx were heavily impacted by the demise of OS/2 by IBM’s own hand. In 1995, by all measures, Rexx was at the top of the world. It was a heavy contender to BASIC and if only for this reason, Microsoft wanted it dead. It is a testament to the intrinsic strength of the Rexx family of languages that it survived the catastrophic series of events that the cancellation of OS/2 and the even lesser known Workplace OS formed. I remember these days vividly: I was scheduled to go to a RedBook writing session in Poughkeepsie when word came that it was all over for Workplace OS. a.k.a. Pink and Blue. Today, we are left with some parts of it, which have been packaged into the International Components for Unicode, and in a bizarre twist of fate, NetRexx has been open sourced using the ICU license.
Because Open Source it is. In the beginning of the nineties, a call for an Object Oriented Rexx became noticeable, and within IBM a project was started to provide one. Called Oryx (for Object Oriented Rexx) in those days, Simon Nash was charged with it, and it produced a Java avant-la-lettre – a collection class library married to a Rexx with an OO-syntax that somehow managed to be compatible to (what, with retroactive continuity, became) Classic Rexx. The Java reference is because the earliest implementations had a bytecode interpreter that predated Java itself a number of years.
In 1995, Mike Cowlishaw did some experimentation to see how a Rexx-like language would behave on the JVM. Some compromises were made to adhere to the JVM’s object model, and for example, the stem notation with dots, an important part of how Classic Rexx defines multidimensional, content-addressed arrays, was dropped, because the dot-notation clashed too much with Java’s method invocation syntax. In its place the indexed string, a notation with square brackets (these were a problem for a long time on EBCDIC producing keyboards) was introduced. Also, all string comparison in NetRexx was to be case insensitive – a feature that Mike always has regretted omitting from Classic Rexx (on the well-meant advice of others).
For the rest, NetRexx is a better Rexx than Rexx itself. In its current form, it is a translator that can compile to .class files, as well as interpret the program in a single shot. Orthogonal to this, there is full-blown application mode, in which the programmer declares all the classes and methods, or scripting mode, in which there is just a number of commands and method invocations specified, and the translator adds all the syntactic ceremony that the Java language requires before compiling or interpreting.
At the essence of NetRexx is the fact that one can write Java classes without all the syntax that is annoying to the programmer that is reared in the non-C tradition. C style syntax has a very paradoxical property, in which terseness has led to ceremonial syntax elements. These are avoided in NetRexx. It has been established that the same program contains up to 40% less lexical elements in NetRexx as compared to Java syntax.
In other respects NetRexx keeps close to Java. As all compiled programs are translated to Java source first, performance has kept up with improvements in the Java hotspot VM architecture. In contrast to Jython and JRuby, there is no performance penalty for unbounded dynamism in the language: one of the early slogans for NetRexx “strong typing without more typing” still is true today.
If you like clean syntax and great performance, you should try NetRexx. Integration with Java class libraries is excellent and transparent. NetRexx is the first alternative language for the JVM, and still the only alternative JVM language that was actually used to implement a part of the JVM runtime in: the bigdecimal library was first written in NetRexx. For the ones that are aware of Mike Cowlishaws’s effort on the part of better handling of decimals by computer(hardware|languages) this is no surprise. The IEEE decimal definition is in large parts equal to the Rexx Language ANSI Standard. It does not get more serious when you care for floating point precision.
With its ancestor Rexx, NetRexx shares the unbounded decimal arithmetic, the TRACE and PARSE statements (study them, and you will be sold), and a set of string functions that was and is still the best on the planet. When this has gotten you interested, know that NetRexx is free and open source, and downloadable from www.netrexx.org. Release 3.02 will be here any day, and it is accompanied by documentation befitting any former IBM product. Currently, there is IDE support for Eclipse, Jedit and Emacs, and since version 3.01 there is no JDK required any more – a JRE will do.
Meta: this post is part of the Java Advent Calendar and is licensed under the Creative Commons 3.0 Attribution license. If you like it, please spread the word by sharing, tweeting, FB, G+ and so on! Want to write for the blog? We are looking for contributors to fill all 24 slot and would love to have your contribution! Contact Attila Balazs to contribute!