The Programming Language Originally Known as REXX has migrated from being a mainframe scripting language to a full object-oriented language, Object Rexx, and has for some time now been open source: Open Object Rexx.
Object Rexx is a pure superset of Rexx, which latter, like Perl, started off as a scripting language whose only full-fledged data type is the character string. As Michael Cowlishaw, inventor of Rexx, told me in 1996:
"There's a lot of overlap [between Perl and Rexx]. Both languages are good, for example, for writing scripts for the Web. They are really quite different philosophies on how to design a language, both valid. Larry Wall's philosophy is to put anything into the language that anybody asks for ... My approach is the other way 'round, that is, don't put anything in unless it's really, really necessary, because then you end up with a really small language with few notations, and you make people happy for a different set of reasons."
Rexx originally appeared around 1979 on IBM mainframes running the VM operating system. It exhibits a line-oriented syntax:
foo = 1 + 2
where, as in TCL and some versions of Basic, variables spring into existence by being referenced or assigned. Statements are either assignments, or start with keywords, or failing both those, are interpreted as commands to the host environment.
That is, a line like
gnorf 1 2 3
(with gnorf not being found as a keyword or function and otherwise lacking the assignment operator =) is passed to the operating system as a command line whose result may later be obtained by the program.
Interesting Rexx features include queues, stacks, and content-addressable memory called "stem variables," wherein all the following
smith = "dink couple"
smith.john = "dentist"
smith.john.car = "1947 Hudson"
smith.mary = "U.S. senator"
smith.mary.car = "PT Cruiser"
are instantiations over all of which, in Object Rexx, one may iterate merely by knowing the stem ("smith").
Beyond that, Rexx exhibits expressions, keywords, and functions internal and external. Expressions work pretty much like you'd imagine from other modern languages. Keywords are idiosyncratic, some taking sub-keywords, and perform basic language tasks such as parsing the arguments to the interpreter invocation. Functions are, well, functions: many are internal to Rexx, some are external but more or less standard, and functions may be added ad infinitum by enterprising programmers via a call API, which allowed Rexx to become the dominant high-level language on the IBM VM operating system.
Rexx leapt from the mainframe and penetrated workstations and desktop computers via commercial implementations on the Amiga, OS/2, MS/DOS, Windows and AIX, while later open source implementations such as Regina brought Rexx to the rest of the world.
Enter Object Rexx
Object Rexx grandfathers in all of classic Rexx and extends the language by adding directives, classes, and member/method invocation. Directives, including declarations of classes, are introduced by double-colons. For instance,
indicates to the interpreter that a file foo (with an appropriate extension which may vary from platform to platform) must be included before commencing interpretation.
introduces a class definition, and
introduces a method definition. Both ::CLASS and ::METHOD must appear after any procedural code in the file, including code that invokes the class and its methods. Invocation of the class is indicated textually by preceding the classname with a dot (.) and methods are indicated by tilde (~) as in
So far, so good, and unexceptional. The kicker, when comparing Object Rexx to, say, Java, is that class definitions are merely an extension of the underlying string data type. Thus classes may be added or redefined dynamically and algorithmically at runtime. This is more or less true nowadays of Perl objects, but Object Rexx got there first with incomparably better syntax than Perl will have until Perl 6 is complete, while Java is still not there and may never be, in view of the requirement for the Java compiler classes (not licensed for redistribution with an application) to be present in order to compile code.
One result of this ability to define classes on the fly is that Object Rexx is an easy-to-use scripting language suitable for (among any number of other uses) modeling new object-oriented languages.
Open Object Rexx downloadable documentation is extensive, elaborate and well written. If you don't know the language before you download, you will indeed know it after R'ing TFM.