NetRexx - Easy scripting
The Rexx language was created by Mike Colishaw in 1970 for IBM, and implemented
on the IBM 370. It was used as a scripting tool on OS/2. It was intended to provide a clear and structured syntax.
NetRexx is a new, object oriented version which was written in 1997, and which compiles into Java bytecode and runs with the Java Virtual Machines.
A king (rex in latin) card is sometimes used
to illustrate the language.
It is talked quite a few of Rexx today, but it's an opportunity to examine a different design for a programming language.
Why use NetRexx?
- Intended to replace Java with a simplest syntax. This is an alternative to Jython (Java Python), but less powerful.
- Can make applets, uses the Java's API.
- Using a same language for scripting and applications.
- Not widely used apart on IBM's environments.
- NetRexx source may be either compiled into bytecode, or directly interpreted.
- It is an Object oriented scripting language.
- Uses Java classes in the code.
- Methods are terminated by another method or the end of the file. "Return" is used only to return a value.
- Block of statements are delimited by "do..end".
- The select case ... when construct if the NetRexx equivalent of switch ... case, but more powerful.
- A general loop construct with options, replaces severals ones of other languages.
- String is the default type for variables.
- The body of a function is terminated by a blank line, that is perhaps unique to this language.
- Fixed size array and dictionary are composite types.
Sample code taken from the NetRexx manual...
Script waiting for an answer:
-- A script loop label prompt forever reply=ask select when reply.datatype('n') then say reply**3 when reply='Quit' then leave prompt otherwise say 'eh?' end end prompt say 'Done.'
Applet displaying Hello World:
-- An applet class HelloApplet extends Applet method init resize(200, 40) method paint(g=Graphics) g.drawString("Hello world!", 50, 30) -- The applet is loaded with this html code: <applet code="HelloApplet.class" width=200 height=40> </applet>