Object REXX explained

Open Object REXX (ooRexx)
Paradigm:Multi-paradigm

object-oriented (class-based), procedural (imperative), structured

Latest Release Version:5.1.0
Latest Preview Version:5.2.0
Typing:dynamic
License:CPL 1.0, GPLv2
Designer:Simon C. Nash (IBM), Rick McGuire (IBM)
Memory Management:Garbage collection
Implementations:Object REXX (until 2004)
ooRexx (since 2005)
Influenced By:Rexx, Smalltalk
Influenced:NetRexx
Programming Language:C++
Platform:IA-32, x86-64, ARM, s390x
Operating System:Cross-platform

Linux, Microsoft Windows, macOS, Solaris, OpenIndiana, AIX, FreeBSD, OS/2

File Ext:.rxs, .rex, .rexx, .cls, .orx, .rexg, .rexp

Object REXX is a high-level, general-purpose, interpreted, object-oriented (class-based) programming language. Today it is generally referred to as ooRexx (short for "Open Object Rexx"), which is the maintained and direct open-source successor to Object REXX.

It is a follow-on and a significant extension of the Rexx programming language (called here "classic Rexx"), retaining all the features and syntax while adding full object-oriented programming (OOP) capabilities and other new enhancements. Following its classic Rexx influence, ooRexx is designed to be easy to learn, use, and maintain. It is essentially compliant with the "Information Technology – Programming Language REXX" ANSI X3.274-1996[1] standard and therefore ensures cross-platform interoperability with other compliant Rexx implementations. Therefore, classic Rexx programs typically run under ooRexx without any changes.

There is also Rexx Object Oriented ("roo!"), which was originally developed by Kilowatt Software and is an unmaintained object-oriented implementation of classic Rexx.

History

In 1988, the "Oryx" project at IBM, under the technical direction of Simon C. Nash, experimented with merging classic Rexx with the object model of Smalltalk.[2] [3] The motivation behind the project was to transfer the advantages of OOP to classic Rexx while remaining compatible and thus transferring the usability of classic Rexx to OOP.[4] Early on, the projects focused on OOP aspect such as treating everything as an object, object-based encapsulation and message passing, object-based concurrency, classes and inheritance.[5] This initial work later led under the direction of Rick McGuire to the first prototype of Object REXX, which was presented in 1992. In 1994, IBM announced that Object REXX would replace classic Rexx as the standard REXX interpreter in the next version of OS/2. In 1996, Object REXX was released as part of the OS/2 Warp 4 operating system.[6] In 1997, versions for Windows 95, Windows NT and Linux followed.[7] [8] In 1999 an Object REXX version for AIX V4.1.5 or higher was released.[9] In 2000, versions for zLinux and Sun/Solaris followed. For Windows 2000, Windows Me, Windows 98 and Windows NT 4.0, the last major update for Object REXX was released in 2001.[10] On 12 October 2004, IBM announced the discontinuation of Object REXX and transferred the source code and licensing rights to the non-profit Special Interest Group (SIG), the Rexx Language Association (RexxLA). The code that IBM released to open source did not include the classes for IBM System Object Model (SOM), which is known as the object framework for OS/2's Workplace Shell (WPS).[11] Although IBM discontinued the development of SOM in 1997, it is still a fundamental framework for OS/2.[12] The OS/2 version of Object REXX includes classes to support SOM and WPS.[13] [14] These are included in OS/2's initial follow-on product, eComStation, and also in its current descendant, ArcaOS, for which IBM's original Object REXX interpreter continues to be available.[15]

In 2005, the RexxLA released ooRexx as a new incarnation of Object REXX as free and open-source software under the Common Public License.[16] This first version of ooRexx 3.0.0 has been heavily refactored compared to the original IBM source code in order to increase readability. Later, the ooRexx kernel was rewritten in pure C++, and a new architecture and native interface were designed and implemented under the technical direction of Rick McGuire. This work enabled the RexxLA to release ooRexx 4.0.0 with support for 64-bit in 2009. To this day, the RexxLA continues to develop, support and maintain ooRexx as well as classic Rexx and NetRexx. Furthermore, the RexxLA organizes international annual symposia.[17]

Releases

The following table contains noteworthy features and changes of major Object REXX and ooRexx interpreter versions. All ooRexx releases and the necessary documentation are available freely on SourceForge.[18] [19] For Arch Linux based distributions the current and the development version are available as Arch User Repository. Since version 5.0.0 there are portable versions of the interpreter that can be used without installation, and an unofficial port to OS/2 also exists. The "net-oo-rexx" bundle contains the latest portable version of ooRexx, Netrexx, a Netrexx shell, the Java bridge and associated packages, a shell for ooRexx and various other packages and programs.[20]

For Intellij IDEA, the ooRexxPlugin adds support for syntax highlighting, syntax checking, code completion and documentation support modeled after Javadoc using annotations.[21] As of September 2012 there is support for syntax highlighting of ooRexx 4.0 features in Vim.[22] RexxCPS is a benchmark that measures the number of Rexx clauses (independent syntax units in a line) per second that an interpreter processes.

Major Releases Release date Notable Features and Changes
1996-09-25
  • First official release as part of OS/2 Warp 4
  • Support for object-oriented paradigm
  • Concepts such as SELECT, DO loops, IF-THEN-ELSE branching
  • Support for procedure and function calls, stems and compound variables
  • Provides array handling, arithmetic and built-in functions
  • Includes interfaces to DB2, TCP/IP sockets and C applications
1997-02-28
  • First releases for Windows
  • Development Edition (1997-05-30) additionally provides a dialogue library and editor as well asa built-in tokeniser
1999-04-09
2001-04-21
2005-03-30
  • First release as open-source
  • Supports 28 keyword instructions, four directives, 29 classes with associated methods and 75 built-in functions
  • Includes an extension class for regular expressions and ooDialog 3.0.0
  • Improved PDF documentation
2006-08-21
  • Various enhancements
  • Separate documentation for ooDialog
2006-11-23
  • Support for Linux, Windows, AIX and Solaris
  • Additional methods for various classes and new functions for the RexxUtil library
  • Addition of CircularQueue class
2007-09-17
  • Support for MacOS
  • Additional methods for the MutableBuffer, String and Object classes
  • Includes interface to Open Office
2008-01-22
  • Various enhancements
2009-09-30
  • Support for 64bit versions of Linux, AIX and Windows
  • Drop support for WSH engine
  • Improved C++ application programming interface
  • Addition of Buffer, IdentityTable, Orderable, Package, Pointer, RexxContext, Routine, WeakReference and SocketClass classes
  • New methods for RexxQueue, Object, DateTime, Method, Stem, String, MutableBuffer, OLEObject classes
  • Additional classes and methods for ooDialog
  • Addition of sample programs and separate documentation for the Windows extension library
2011-09-28
2014-02-23
  • More than 43 enhancements (e.g. tracing)
  • Standalone installer for ooDialog 4.2.3 and several new classes and methods
  • Systemd support and compliance with Linux Standard Base
  • New methods for the Relation, OrderedCollections, Array, String, Mutablebuffer, StackFrame, Queue and OrderedCollection classes
  • Separate documentation for ooSQLite external library
2022-12-22
  • A total of 86 new features and 76 enhancements
  • Addition of AlarmNotification, Json, MessageNotification, RexxInfo, StringTable and Validate classes
  • New methods for Alarm, Class, Collection, Directory, Message, Method, MutableBuffer, Object, Package, Routine, String and RxFtp classes
  • Separate documentation ooRexxUnit (unit testing framework), orxnCurses (ncurses library), C/C++ APIs and the release and build environment
2025-05-02
  • A total of 36 enhancements
  • Several improvements to Json class
  • Inclusion of oleinfo scripts to facilitate Windows automation
  • Addition of the TraceObject class to support the tracing of multi-threaded programs
2025-05-05

Design philosophy

ooRexx follows the design philosophy of classic Rexx to create a "human-centered" programming language that is easy to learn, code, remember and maintain. This is achieved, in part, by keeping the language small and following the principle of least astonishment.[24] [25] A readable syntax is enabled by being case-insensitive, free-form, requiring as little punctuation as possible, and using instructions that are straightforward English. In addition, it is a dynamic programming language that offers flexibility and allows to focus on development rather than language constraints.

Following the "documentation before implementation" design principle of classic Rexx, ooRexx offers comprehensive documentation in accordance with the IBM Style Guide that includes syntax diagrams and examples.[26]

Instructions

As in classic Rexx, there are assignment instructions, keyword instructions and command instructions. In line with the desire to keep the language small, ooRexx has only thirty keyword instructions. Unlike many other languages, no keywords are reserved, so keyword instructions such as DO, SAY, END and IF for example can be used as variable names during an assignment. This avoids having to memorize a long list of reserved words. An assignment is used to set or change the value of a variable. The equal sign (=) is used to create an assignment instruction which can be used in combination with eleven operators for extended assignment sequences such as +=, -=, *= and others. Keyword instructions such as ARG, PARSE, PULL or USE have the same effect as assignments.

In cases where an instruction is neither an assignment nor a keyword instruction, it must be a valid expression, e.g., a symbol, a string literal, which is considered a command instruction, whose value the interpreter passes to the current command environment, e.g., editor, operating system, for execution; the interpreter sets a variable RC for the return code. In addition, the ADDRESS instruction allows commands to be redirected to specific command environments such as Bourne Shell, Bash, Z-Shell, Command Prompt and others, some editors including ISPF, TSO EDIT, XEDIT and its adaptations, as well as intercepting errors.a = "hello world" /* assignment instruction */do i = 1 to 2 /* keyword instruction "DO" */ say "round #" i":" a /* keyword instruction "SAY" */end /* keyword instruction "END" */"echo Hello World" /* command to operating system */say "RC:" rc /* command's numeric return code */In addition to the three instruction types of classic Rexx, ooRexx adds directive instructions which need to be placed at the end of the program. After loading and the syntax check, the interpreter executes all defined directives to set up the execution environment for the program before further instructions are executed. Directives can be used to define routines, classes, methods, attributes or execution options like the number of digits to use in arithmetics. To make directive instructions readily recognizable, they are introduced with two consecutive colons (::).

To facilitate the reusability of code, the ::REQUIRES directive allows the integration of another Rexx program (also known as a package) or an external (native) library. This directive causes the interpreter to make every routine and class that specifies the PUBLIC option of the denoted Rexx program (package) to become directly accessible. External packages usually use the file extension .cls, for example ::requires "csvstream.cls" or ::requires "json.cls". Some external packages and libraries are delivered with the ooRexx interpreter.

Free-form

ooRexx has a free-form syntax where the positioning of the program code is irrelevant, which allows a high degree of flexibility. Before execution, the interpreter merges multiple unquoted blanks into one, while a character string enclosed in quotation marks (single or double) is not changed. Concatenation can be requested explicitly with two vertical bars (||), or implicitly by separating terms with spaces or by abutting terms. Optionally, clauses can be spread over several lines by using the comma (,) or the minus sign (-) as a continuation character, or several clauses can be used in a single line, separated by a semicolon (;). Since a free-form language provides flexibility and requires fewer syntactic rules to be considered, it is assumed that it eases the learning effort by reducing the intrinsic cognitive load.[27] say "Hello World!" /* output: Hello World! */say " This" 'is' - /* trailing dash for continuation */ "REXX" || "!" /* output: This is REXX! */

Case-insensitive

As classic Rexx, ooRexx is a case-insensitive programming language. Accordingly, the ooRexx interpreter capitalizes all characters outside quotation marks (single or double) and ignores case for instructions, variable names and all other aspects of the language. Only sequences within quotation marks are treated as literal strings and are not changed during processing. Because the cases do not need to be differentiated, fewer additional details need to be learned and frustrating syntax errors are avoided.a = "This is" rexx!Say A /* output: This is REXX! */SAY a /* output: This is REXX! */

Everything is an Object

While classic Rexx follows the "Everything is a String" philosophy and has string as its only data type, ooRexx considers everything as objects, including non-string objects such as arrays, streams and many more. Objects are manipulated using methods instead of traditional functions.

In ooRexx, a string variable is a reference to a string object and does not need to be declared, which reduces the effort for programmers compared to strictly typed languages.[28] A string object can be of any length and contain any characters, including numerical values. It is therefore possible to change numerical values with string manipulations and methods of the String class. In addition, a string variable can contain any type of expression, including executable instructions, which can be evaluated or executed with the INTERPRET keyword instruction.a = 2 /* string with numerical value */a = a || '0' /* resulting string: 20 */

str = "do i = 1 to "a"; say i; end" /* string contains loop instruction */interpret str /* interpret string: counts to 20 */

Message paradigm

Similar to the messaging paradigm implemented by Alan Kay in Smalltalk, everything in ooRexx is an object that can be communicated with. The notion of sending messages to objects as if they were living beings helps beginners to learn OOP concepts.[29] In contrast to Smalltalk, there is an explicit message operator, the tilde (~), where the receiving object is placed to the left of it and the result of the operation is returned. Sending a message leads to the activation of a method with the corresponding method name and to the manipulation of the receiving object. Like Smalltallk, ooRexx messages can be cascaded if two tildes (~~) are used instead of one, returning the object that received the method rather than the result produced.[30]

The default behavior of most methods can be changed by specifying an option, which can be either spelled out or abbreviated and is not case-sensitive. When reading code, this enables a literal understanding and reduces the learning effort for beginners, as there is no need to learn the meaning of abbreviations. For example, the method with the name strip removes leading and trailing blanks by default. This behavior can be changed, for example, by specifying "leading" or "l" as an option. While functions are nested in classic Rexx, messages can be chained in ooRexx, which improves the readability of a statement.a = " I am ooRexx!"say a /* output: I am ooRexx! */say a~Strip("Leading") /* output: I am ooRexx! */say a~strip("l")~reverse /* output: !xxeRoo ma I */

Compatibility

ooRexx is designed to retain all the features of classic Rexx and essentially complies with the ANSI standard for the Rexx language (X3.274-1996, "Programming Language REXX"). In contrast to an optional specification in the ANSI standard, ooRexx does not allow characters such as @, #, $ and Β’ in symbols. While in classic Rexx the expression b. = a. results in b. being assigned the default value of a., the interpreter makes b. an alias for a.. In addition, ooRexx allows -- as a comment mark and - as a line continuum, which are not specified in the standard.

Classic Rexx scripts typically run without changes under ooRexx, making it easy to migrate to OOP features at the desired rate while preserving the time invested in the original code. There are incompatibilities with some platform-specific implementations such as Rexx for z/VM (e.g. PARSE EXTERNAL is not supported by ooRexx). While classic Rexx allows empty assignments such as x = ;, quotation marks x = ""; are necessary in ooRexx.[31]

Customization

ooRexx offers various customization mechanisms, such as extending built-in functions and classes, using unspecified methods, adding command environments and invocation switches or creating own builds.[32]

The default behavior of built-in functions can be changed by adding a label with the same name as the function to be overridden (e.g. date) at the end of the program scope or by adding a ::routine directive. The code can either calculate results itself or modify the results of the original built-in function.say Date /* output, e.g.: 16 JUN 2025 */exit

Date: return newDate /* label pointing to "newDate" routine */

Routine newDate newDate = date~upper /* use of date BIF, but with capital letters */ return newDateSince ooRexx 5.0.0 namespaces have been added that allow the subclassing of built-in classes. This makes it possible to extend built-in classes, e.g. by adding a method such as ArrayInClose to the stream class, which opens the stream, reads the content and closes the stream instead of doing this in the program scope.Say .stream~new("someFile.txt")~ArrayInClose

Class stream subclass rexx:stream /* create a subclass of stream */ ::Method ArrayInClose /* add new method to stream class */ self~open /* open the stream */ FileContent = self~ArrayIn /* read content */ self~close /* close the stream */ return FileContent /* return content */The definition of an UNKNOWN method enables objects to receive unspecified messages. Two arguments are passed, firstly the name of the unspecified method and secondly an array of arguments from the original message. This is a basic mechanism of the Java Bridge, which enables among other things the use of all available Java methods.PackageObj = .Package~newPackageObj~SomeMethod("First", "Second", "Third")

Class Package ::Method Init ::Method Unknown Use arg MethodName, ArgArr say "Method was:" MethodName /* output: Method was: SOMEMETHOD */ say ArgArr /* output: First, Second, Third */

Features

Above all, ooRexx offers OOP features such as subclassing, polymorphism, data encapsulation and multiple inheritance via mixin classes. The interpreter includes the rexxc utility, which makes it possible to compile ooRexx programs and optionally encode the result as base64, a source-less file that starts faster since the initial parsing and compiling has already been done.

Parsing

The PARSE keyword instruction makes it possible to quickly and flexibly parse a string and assign parts of it to variables in a single step. Subsequent instruction is used to specify the source of the string, for example ARG for arguments that are listed when the program or function is called, VAR for variables, PULL for data queues or standard input (typically the keyboard), VALUE for any expression. When using VALUE, the WITH keyword is required to specify the end of an expression, followed by a parsing pattern. This pattern can be a list of variables, a position number or literal delimiters; it is possible to use these patterns in combination. Optionally, the upper and lower case of the string can be converted before parsing.str = "Person: Rick McGuire" /* parse string using the literal ":" and blanks between words into variables a ("Person"), b ("Rick"), and c ("McGuire") */parse var str a ":" b c /* parse by literal and blank */say b c /* output: Rick McGuire */

Procedure and function

ooRexx provides a new way to define procedures and functions that are not specific to a particular class by using the ::ROUTINE directive; unlike the older PROCEDURE, code defined with ::ROUTINE has an implicit RETURN at the end. The CALL instruction can be used to invoke a routine as a procedure. In addition, routines that return values via the RETURN keyword instructions can be called using function calls by specifying the name of the routine followed by parentheses. The content within the parentheses is passed as arguments to the routine. While the PARSE ARG instruction can be used to parse received string arguments and assign them to variables, the newer USE ARG must be used for objects of other types. In addition, the STRICT option can be used to limit the number of arguments that must match the number of specified names.call DoSomething /* "CALL" keyword instruction */table = .stem~new /* Stem object for indsum */table[1] = 2; table[2] = 4say indsum

Notes and References

  1. Web site: X3.274-1996 American National Standards Institute for Programming Language Rexx .
  2. Web site: 7 Reasons that Rexx Still Matters . 2024-06-19 . SmartBear.com.
  3. Web site: IBM Object REXX – EDM2 . 2024-06-19 . www.edm2.com.
  4. Nash . Simon C. . 1990-06-11 . Object Oriented REXX . Proceedings of the REXX Symposium for Developers and Users . 76–100.
  5. Nash . Simon C. . 2009-05-21 . An Object Rexx Retrospective . Proceedings of the 20th Rexx Language Symposium.
  6. Web site: IBM Object REXX for OS/2 – EDM2 . 2024-06-19 . www.edm2.com.
  7. Web site: 1997-02-25 . IBM Object REXX Now Runs on Windows NT and Windows 95 . IBM.
  8. Schweizer . Manfred . Berger . Uwe . 2005-04-21 . From Object REXX to ooRexx . Proceedings of the 16th Rexx Language Symposium.
  9. Web site: 1999-03-30 . IBM Object REXX for AIX – Object-Oriented Scripting Language for Beginners to Advanced Programmers . IBM.
  10. Web site: 2001-03-20 . IBM Object REXX for Windows V2R1 – Object-Oriented Programming for Beginners to Advanced Users . IBM.
  11. [sourceforge:p/oorexx/discussion/408479/thread/1f93f87f/|Where did SOM support go in 4.0.0?]
  12. Web site: SOM and Object REXX – EDM2 . 2024-12-11 . www.edm2.com.
  13. Web site: Willis Boughton . 2004 . SOM and Object REXX . 2014-02-02 . EDM/2.
  14. Book: Object REXX Reference . IBM . Accessing Workplace Shell Objects.
  15. Web site: Does ArcaOS include REXX support? . 2020-09-03.
  16. Web site: 2004-10-12 . Software withdrawal and service discontinuance: IBM Object REXX . IBM.
  17. Web site: RexxLA – Rexx Symposia . 2024-05-17 . www.rexxla.org.
  18. Web site: ooRexx (Open Object Rexx) - Browse /oorexx at SourceForge.net . 2024-05-18 . sourceforge.net.
  19. Web site: ooRexx (Open Object Rexx) - Browse /oorexx-docs at SourceForge.net . 2024-05-18 . sourceforge.net.
  20. News: 1 December 2024 . Net-oo-rexx Readme .
  21. News: Flatscher . Rony G. . 2023 . The IntelliJ IDEA Plugin ooRexxPlugin 2.2 for Rexx and ooRexx 5.0 .
  22. Web site: Geulig . Thomas . 2012 . Vim syntax file: Rexx .
  23. News: ooSQLite: Readme . 18 May 2024.
  24. Book: Fosdick, Howard . Rexx Programmer's Reference . Rexx Language Association . 2024 . 979-898611913-7 . 2nd.
  25. Cowlishaw . Mike . 1987 . The design of the REXX language . ACM SIGPLAN Notices . 22 . 2 . 26–35. 10.1145/24686.24687 . subscription .
  26. Book: Ashley . W. David . ooRexx Documentation 5.1.0 Open Object Rexx Reference . Flatscher . Rony G. . Hessling . Mark . McGuire . Rick . Peedin . Lee . Sims . Oliver . Wolfers . Jon . RexxLA . 2025.
  27. Winkler . Till . Flatscher . Rony G. . Cognitive Load in Programming Education: Easing the Burden on Beginners with REXX . Central European Conference on Information and Intelligent Systems.
  28. Stefik . Andreas . Siebert . Susanna . 2013 . An empirical investigation into programming language syntax. . ACM Transactions on Computing Education . 13 . 4 . 1–40 . 10.1145/2534973. subscription .
  29. Flatscher . Rony G. . Winkler . Till . Employing the Message Paradigm to Ease Learning Object-oriented Concepts and Programming . In 2024 47th MIPRO ICT and Electronics Convention (MIPRO) . 1244–1249.
  30. Book: Ashley . W. David . ooRexx Documentation 5.1.0 Programmer Guide . Flatscher . Rony G. . Hessling . Mark . McGuire . Rick . Peedin . Lee . Sims . Oliver . Wolfers . Jon . 2025 . RexxLA.
  31. Web site: ooRexx (Open Object Rexx) / Discussion / Help: "... and will execute classic REXX programs unchanged" . 2025-06-17 . sourceforge.net.
  32. Barmwater . Gil . 2025 . Customizing ooRexx . Proceedings of the 35th International Rexx Symposium.