Object REXX
   HOME

TheInfoList



OR:

Object REXX is a high-level, general-purpose, interpreted, object-oriented ( class-based)
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
. 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 Rexx (restructured extended executor) is a high-level programming language developed at IBM by Mike Cowlishaw. Both proprietary and open-source software, open source Rexx interpreter (computing), interpreters exist for a wide range of comput ...
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 The American National Standards Institute (ANSI ) is a private nonprofit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organiz ...
X3.274-1996 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 International Business Machines Corporation (using the trademark IBM), nicknamed Big Blue, is an American Multinational corporation, multinational technology company headquartered in Armonk, New York, and present in over 175 countries. It is ...
, under the technical direction of Simon C. Nash, experimented with merging classic Rexx with the object model of
Smalltalk Smalltalk is a purely object oriented programming language (OOP) that was originally created in the 1970s for educational use, specifically for constructionist learning, but later found use in business. It was created at Xerox PARC by Learni ...
. The motivation behind the project was to transfer the advantages of OOP to classic Rexx while remaining compatible and thus transferring the
usability Usability can be described as the capacity of a system to provide a condition for its users to perform the tasks safely, effectively, and efficiently while enjoying the experience. In software engineering, usability is the degree to which a softw ...
of classic Rexx to OOP. Early on, the projects focused on OOP aspect such as treating everything as an object, object-based encapsulation and
message passing In computer science, message passing is a technique for invoking behavior (i.e., running a program) on a computer. The invoking program sends a message to a process (which may be an actor or object) and relies on that process and its supporting ...
, object-based concurrency, classes and
inheritance Inheritance is the practice of receiving private property, titles, debts, entitlements, privileges, rights, and obligations upon the death of an individual. The rules of inheritance differ among societies and have changed over time. Offi ...
. 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 OS/2 is a Proprietary software, proprietary computer operating system for x86 and PowerPC based personal computers. It was created and initially developed jointly by IBM and Microsoft, under the leadership of IBM software designer Ed Iacobucci, ...
. In 1996, Object REXX was released as part of the OS/2 Warp 4 operating system. In 1997, versions for Windows 95,
Windows NT Windows NT is a Proprietary software, proprietary Graphical user interface, graphical operating system produced by Microsoft as part of its Windows product line, the first version of which, Windows NT 3.1, was released on July 27, 1993. Original ...
and
Linux Linux ( ) is a family of open source Unix-like operating systems based on the Linux kernel, an kernel (operating system), operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically package manager, pac ...
followed. In 1999 an Object REXX version for AIX V4.1.5 or higher was released. In 2000, versions for zLinux and Sun/Solaris followed. For
Windows 2000 Windows 2000 is a major release of the Windows NT operating system developed by Microsoft, targeting the server and business markets. It is the direct successor to Windows NT 4.0, and was Software release life cycle#Release to manufacturing (RT ...
,
Windows Me Windows Me (Millennium Edition) is an operating system developed by Microsoft as part of its Windows 9x family of Microsoft Windows operating systems. It was the successor to Windows 98, and was released to manufacturing on June 19, 2000, and t ...
,
Windows 98 Windows 98 is a consumer-oriented operating system developed by Microsoft as part of its Windows 9x family of Microsoft Windows operating systems. It was the second operating system in the 9x line, as the successor to Windows 95. It was Software ...
and Windows NT 4.0, the last major update for Object REXX was released in 2001. On 12 October 2004, IBM announced the discontinuation of Object REXX and transferred the
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
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). Although IBM discontinued the development of SOM in 1997, it is still a fundamental framework for OS/2. The OS/2 version of Object REXX includes classes to support SOM and WPS. 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. In 2005, the RexxLA released ooRexx as a new incarnation of Object REXX as
free and open-source software Free and open-source software (FOSS) is software available under a license that grants users the right to use, modify, and distribute the software modified or not to everyone free of charge. FOSS is an inclusive umbrella term encompassing free ...
under the Common Public License. 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 Architecture is the art and technique of designing and building, as distinguished from the skills associated with construction. It is both the process and the product of sketching, conceiving, planning, designing, and construction, constructi ...
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.


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. 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 a
unofficial port to OS/2
also exists. Th
"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. For Intellij IDEA, the ooRexxPlugin adds support for syntax highlighting, syntax checking, code completion and documentation support modeled after
Javadoc Javadoc (also capitalized as JavaDoc or javadoc) is an API documentation generator for the Java programming language. Based on information in Java source code, Javadoc generates documentation formatted as HTML and other formats via extensions. ...
using annotations. As of September 2012 there is support for syntax highlighting of ooRexx 4.0 features in Vim
RexxCPS
is a benchmark that measures the number of Rexx clauses (independent syntax units in a line) per second that an interpreter processes.


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. 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 A dynamic programming language is a type of programming language that allows various operations to be determined and executed at runtime. This is different from the compilation phase. Key decisions about variables, method calls, or data types are ...
that offers
flexibility Stiffness is the extent to which an object resists deformation in response to an applied force. The complementary concept is flexibility or pliability: the more flexible an object is, the less stiff it is. Calculations The stiffness, k, of a ...
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.


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 string literal or a valid expression which is considered a command instruction, which causes the interpreter to pass the string to the operating system for execution and set 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 In computing, Interactive System Productivity Facility (ISPF) is a software product for many historic IBM mainframe operating systems and currently the z/OS and z/VM operating systems that run on IBM mainframes. It includes a Text editor, screen e ...
, 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. 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. 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. 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. 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.


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. The default behavior of built-in functions can be changed by adding a label with the same name as the function to be overwritten (e.g. date) at the end of the program scope. This label can either return results itself or the results of a ::routine if the original built-in function is to be used and extended. say Date() /* output, e.g.: 16 JUN 2025 */ exit Date: return newDate() /* lable pointing to "newDate" routine */ ::Routine newDate newDate = date()~upper /* use of date() BIF, but with capital letters */ return newDate Since 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~new PackageObj~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 = 2; table = 4 say indsum{table,1.2) /* function call requiring use arg */ say dirsum(2,4) /* either parse arge or use arg okay */ ::Routine DoSomething /* "ROUTINE" directive (procedure) */ say "I did something!" /* output: I did something! */ /* Implicit return because next */ /* statement is a directive. */ ::Routine dirsum /* "ROUTINE" directive (function) */ parse arg first, second /* Valid because both are strings. */ return first+second ::Routine indsum /* "ROUTINE" directive (function) */ use strict arg table, first, second /* can't use parse arg with stem arg */ Sum = table{first} + table econd /* do calculation */ return Sum /* "RETURN" result */


Class and Method

The ::CLASS directive followed by a class name causes the interpreter to define a new class. After the class name, options such as METACLASS, SUBCLASS, MIXINCLASS, ABSTRACT and INHERIT can be set in order to use OOP features. The ::METHOD directive can be used to define a new class method that is associated with the last ::CLASS directive. The ::ATTRIBUTE directive is used to define an accessor method that can retrieve or assign an object variable. Using the EXPOSE instruction, an object variable can be directly exposed to a method. d = .dog~new("Bella") /* create and assign a dog */ d~bark /* send bark message */ say d~name /* output: Bella */ ::class dog /* class directive */ ::attribute name /* attribute directive */ ::method init /* object initiation method */ Expose name /* exposes name of dog */ use arg name /* assigns "Bella" to name */ ::method bark /* method directive */ Expose name say Name "goes woof!" /* output: Bella goes woof! */


Error handling

The SIGNAL keyword instruction can be used to switch the trapping of certain conditions ON or OFF when they are triggered. Several condition traps can be specified, for example ERROR or FAILURE triggered by a command instruction that indicates an error or failure on return, SYNTAX raised by invalid program syntax or other error conditions, HALT is triggered by an external interruption attempt (e.g. the key combination Control-C). ANY can be used to intercept anything that a more specific condition trap does not trap. Other more specific condition traps are LOSTDIGITS (arithmetic operation has more digits than specified by the current setting), NOMETHOD (method used is not specified and object has no UNKNOWN method), NOSTRING (object does not return a required string value), NOTREADY (error during an input or output operation) or NOVALUE (use of an uninitialized variable). The built-in CONDITION function can be used to retrieve information such as the name of the current intercepted condition and the resulting instruction process, the status of the intercepted condition, a descriptive string and additional object information. Signal on Syntax /* switch on SYNTAX trap */ Say 1 + "AString" /* an impossible calculation */ Exit SYNTAX: ConditionObject = Condition(Object) /* get additional information */ say "Error code is" ConditionObject~Code /* output: Error code is 41.1 */ say ConditionObject~ErrorText /* output: Bad arithmetic conversion. */ Similarly, the CALL keyword instruction can be used not only to invoke a routine, but also to control the trapping of certain conditions when ON or OFF is specified along with a specific condition trap (e.g. CALL ON HALT and CALL OFF HALT). These instructions do not flush the control stack, and normal execution resumes when the condition handler returns.


Multi-threading

Conceptually, ooRexx provides object-based concurrency, according to which objects have independent resources to execute methods and can communicate with each other using the messaging paradigm. Several objects can be active at the same time and exchange messages for
synchronization Synchronization is the coordination of events to operate a system in unison. For example, the Conductor (music), conductor of an orchestra keeps the orchestra synchronized or ''in time''. Systems that operate with all parts in synchrony are sa ...
. Concurrency can be achieved with the REPLY keyword instruction, which causes an early return from a method while its remainder continues to execute in a new thread. Alternatively, the keyword instruction GUARD can be used to mark a method as unprotected so that it can be executed together with other methods of the same class. Finally, using the START method (Object or Message class) causes the recipient to process the received message in a separate thread, thus also enabling concurrency.


Tracing

As in classic Rexx, the TRACE keyword statement and the built-in TRACE() function facilitate debugging. Both allow control over the level of detail and enable interactive debugging at runtime. When interactive debugging, the interpreter pauses after most instructions that are traced. ooRexx 5.1.0 introduces the TraceObject class, which facilitates the tracing of multi-threaded programs, for example by making it easier to determine which method is currently being guarded and blocked. The amount of additional information provided can be specified by using either the "Thread", "Standard", "Full" or "Profiling" option. As an example, the "Full" option shows interpreted instance, thread, invocation and attribute pool IDs as well as the current guard state, the lock count, guard lock reserved indicator and waiting state. trace off /* do not trace prolog */ .TraceObject~option = "Full" /* set option to "Full" */ .TraceObject~collector = .array~new o = .Test~new /* create an instance */ say "starting worker asynchronously ..." o~start("do") /* dispatched on a new thread */ say "about to wait for worker to end ..." o~wait /* synchronize with worker */ say "waiting is over" ::class Test ::method init /* constructor */ expose lock /* access attribute */ lock = .true /* set default */ ::method wait unguarded expose lock /* access attribute */ guard on when lock = .false ::method do /* do some work */ expose lock /* access attribute */ t = random(1,999)/1000 say "do: working for" t "secs" call sysSleep t say "do: ending work" lock = .false /* release lock */ ::options trace results The ooRexx debugger, which is also included in the "net-oo-rexx" bundle, is based on Trace and offers a
graphical user interface A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
(GUI) that uses the Java bridge to facilitate debugging on all platforms.


Built-in functions and classes

As ooRexx aims to be compatible with classic Rexx, the traditional built-in functions are still available. Release 5.1.0 provides 82 built-in functions, including character manipulation, conversion and information functions, many of which call methods of the String class. In addition, the built-in
dynamic link library A dynamic-link library (DLL) is a shared library in the Microsoft Windows or OS/2 operating system. A DLL can contain executable code (functions), data, and resources. A DLL file often has file extension .dll even though this is not require ...
RexxUtil offers 29 cross-platform, 25 Windows-specific and four Unix-specific functions for manipulating system files, directories, classes and objects. In keeping with its object-oriented roots, ooRexx provides most of its functionality via built-in classes and methods. ooRexx 5.1.0 is delivered with a total of 58 built-in classes, which are divided into the class groups Fundamental, Stream, Collection and Utility.


Fundamental classes

Fundamental classes are the essential building blocks for all other classes. The Object class is the root of the class hierarchy, so that its methods and attributes are available for all instantiated objects of each class. The Class class (a.k.a. meta class) is used to maintain the properties of a class (like its method objects) and gets used for creating instances (a.k.a. objects, values). Therefore, an instance of this class (a.k.a. class object) is created for each ::CLASS directive. The purpose of the Method class and Routine class is to create method or routine objects. The String class provides methods for handling strings, such as logical operations, concatenation, copying, joining, splitting, reversing, arithmetic, conversion, and others. A Package class instance contains all created routines, classes, and methods and manages external dependencies referenced by ::REQUIRES directives. The Message class enables the asynchronous sending of messages, which enables the concurrent execution of methods.


Stream classes

Stream classes facilitate communication with external objects such as files, queues, serial interfaces, devices, etc. The Stream class itself is a mixin class that can be inherited and is a subclass of the InputOutputStream, InputStream, and OutputStream classes. The Stream class provides methods for opening, reading, writing, and closing streams and flushing buffers, setting the file location, retrieving information, and other stream-related operations. While the OPEN method opens the stream, the ARRAYIN method can be used to read its content into an array object. The CLOSE method explicitly closes a stream before the stream object is reclaimed by the garbage collector.StreamObj = .stream~new("someFile.txt") /* create stream object */ StreamObj~open /* open the stream */ FileContent = StreamObj~ArrayIn /* read content */ StreamObj~close /* close the stream */ say FileContent /* outputs content */


Collection classes

A collection is an object that contains multiple items with associated indexes that enable items to be retrieved using the AT or [] methods. There are MapCollection, SetCollection and OrderedCollection classes, all of which allow manipulation of a specific collection type. A MapCollection is a mixin class that defines the basic set of methods implemented by all collections that map from an index to a value. The Directory, StringTable, IdentityTable, Properties, Table, Relation and Stem classes inherit these methods. A Directory or a StringTable object is a collection of unique string indexes. In an IdentityTable object, each item is associated with a single index, and there can only be one item for each index. The Properties object provides specific methods for saving and loading properties into files. Unlike a Table object, which cannot contain duplicate indexes, a Relation object is a collection in which elements can have the same index, which can be of any object type. A Stem object is created automatically when a compound variable is used. As in classic Rexx, such a variable consists of a stem and a tail, separated by a dot (.). While the stem must begin with a letter, the tail can be any character. Using a single numeric tail creates the same effect as an array, while multiple numeric tails can be used to create a multidimensional array.fruits.1 = "Apple" /* assigning to stem variable */ fruits.4 = "Orange" /* assigning to stem variable */ say fruits.4 /* output: Orange */ say fruits. /* output: Apple */SetCollections are special types of MapCollections where the index and the element are the same object. While the indexes in a Set object are unique, each index in a Bag object can appear more than once. An OrderedCollection is a mixin class that defines the basic methods for all collections that have an inherent index order, such as the List, Queue, CircularQueue and Array classes. A List object allows new items, for which a new index is created, to be added at any position in a collection. The associated index remains valid for that item regardless of other additions or removals. A Queue object allows items to be removed from the head and added to the tail or head of the queue. A CircularQueue object is a queue with a predefined size. Once the end of the circular queue is reached, new elements are inserted from the beginning to replace the previous items. An Array is sequenced collection ordered by whole-number indexes. Like some other collection classes, the Array class provides the MAKESTRING method to encode its elements as a string object. ArrayObj = .array~of("One", "Two", "Three") /* array with 3 items */ say ArrayObj~at(2) /* output: Two */ say ArrayObj~makeString(,"; ") /* output: One; Two; Three */


Utility classes

Utility classes are a collection of 31 classes that provide implementations for common tasks. The MutableBuffer class enables greater efficiency in string operations such as concatenation, as no new object needs to be assigned. The File class provides methods for listing files in a directory or retrieving information about files and directories. FileObj = .File~new("~/someFolder/") /* create file object for folder */ FileArr = FileObj~ListFiles /* retrieve array of files */ do FilePath over FileArr /* iterate over the array items */ say FilePath /* output: FilePath item */ end The DateTime or TimeSpan classes support the retrieval and formatting of a date, time or timestamp in various formats and enable arithmetic operations between them. Several Comparator classes facilitate sorting for built-in classes such as File, DateTime and others. The class Supplier and its subclass StreamSupplier enable the enumeration of an items collection together with an indexes collection. The Validate class provides methods that can be used to check whether given arguments are of the correct class and type, or within a numerical range. A VariableReference instance maintains a reference, while a WeakReference instance creates a reference to another object that is not pinned. A
regular expression A regular expression (shortened as regex or regexp), sometimes referred to as rational expression, is a sequence of characters that specifies a match pattern in text. Usually such patterns are used by string-searching algorithms for "find" ...
is a pattern that can be used to match strings. To increase the readability of patterns in the code, the RegularExpression class allows the use of symbolic names encapsulated with colons (:) for common sets. For instance, matching a string containing only letters typically described as -Za-z/code> can be abbreviated using alpha:/code>. Other classes help to obtain information about the context of the currently executed code (RexxContext), the Rexx language or the executing platform (RexxInfo) and execution specifics (StackFrame) via environment symbols. The Buffer and Pointer classes are specifically designed to support writing methods and function in native code using the C/C++ APIs. Alarm and Ticker classes provide notification functions and EventSempahore and MutexSempahore classes implement synchronization mechanisms for multi-threading activities. The Monitor class enables messages to be forwarded to various target objects and the RexxQueue class provides object-like access to external Rexx data queues.


External packages and libraries

Using the ::REQUIRES directive and specifying the LIBRARY option, external libraries can be integrated per program. Such libraries are usually organized around domain-specific functions.


Supplied with interpreter

The Rexx extension library offers classes for reading and writing
comma-separated values Comma-separated values (CSV) is a text file format that uses commas to separate values, and newlines to separate records. A CSV file stores Table (information), tabular data (numbers and text) in plain text, where each line of the file typically r ...
(CSV) files, as well as for creating and processing JavaScript Object Notation (JSON) data. A library called “hostemenu” is also included, which partially emulates a TSO/ CMS environment. The RxSock native library enables to incorporate TCP/IP protocols, while the RxFtp native library specifically provides access to the
file transfer protocol The File Transfer Protocol (FTP) is a standard communication protocol used for the transfer of computer files from a server to a client on a computer network. FTP is built on a client–server model architecture using separate control and d ...
(FTP). The RxMath native library offers advanced mathematical functions such as square root calculation, exponential function, logarithm, sine, cosine, tangent, arc sine and power calculation. Say rxcalcsin(1) /* output: 0.0174524064 */ ::requires 'rxmath' LIBRARY /* load a native library */ For Windows, ooRexx includes the ooDialog framework allowing to produce Windows dialogs and therefore
graphical user interfaces A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
. The interpreter is delivered with several example programs and function packages that demonstrate the use of this framework. For
POSIX The Portable Operating System Interface (POSIX; ) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines application programming interfaces (APIs), along with comm ...
-compatible operating systems, the orxnCurses class library enables the writing of text-based user interfaces using the ncurses programming library. The RxUnixSys library provides functions on most
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
systems for interacting with processes and threads, users and user groups, files and file systems and other. Many of these external packages and libraries are also compatible with other Rexx implementations.


Not supplied with interpreter

There are also packages that need to be downloaded and added manually. As part of the Net-oo-rexx bundle, the Regex package enables handling regular expressions, while Log4rexx provides a logging framework and Oorexxshell an interactive ooRexx shell. The Mod_Rexx package provides a module for Apache 2.4 that gives an interface to ooRexx under Windows, AIX and Linux and enables all phases of an Apache request to be processed. The Rexx Parser package provides an abstract syntax tree parser for Rexx and ooRexx, which assigns a category to all script elements, while the Rexx Highlighter package expands the parser and enables highlighting to be output as HTML, ANSI colors,
LuaTex LuaTeX is a TeX-based computer typesetting system which started as a version of pdfTeX with a Lua (programming language), Lua scripting engine embedded. After some experiments it was adopted by the TeX Live distribution as a successor to pdfTeX (i ...
and
LaTeX Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latices are found in nature, but synthetic latices are common as well. In nature, latex is found as a wikt:milky, milky fluid, which is present in 10% of all floweri ...
. The Rexx XML parser enables the parsing of
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
files into an in-memory model and access to this model via a DOM-like API. ooRexxUnit is a test framework inspired by JUnit that enables the execution of ooRexx test cases that help to verify whether an application's specifications are met.


Bridges

While ooRexx compared to Object REXX no longer contains classes for SOM and WPS support, it offers application programming interfaces (APIs) for interacting with code written in C or C++. There is also an external library that implements a bidirectional
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
bridge, which enables interaction between ooRexx and Java. There are also classes that enable interaction with SQL databases and the automation of Windows applications. At the 36th Rexx Symposium, an experimental bridge to Python was presented.


C/C++ APIs

As classic Rexx, ooRexx includes APIs for extending Rexx with applications written in C and vice versa. This enables the creation of handlers for subcommands used in Rexx programs that run as application macros, external functions that allow a direct extension of the ooRexx function set and system functions that allow the behavior of the interpreter to be customized. With ooRexx 4.0.0 APIs have been introduced that allow C++ applications to extend ooRexx and vice versa. This includes handlers for methods and functions written in C++ that extend ooRexx, both packaged as external libraries. These are dynamic link libraries on Windows or as shared libraries on Unix-based systems. An external library can be loaded with the ::REQUIRES directive or by using the EXTERNAL keyword instruction as part of a ::ROUTINE, ::METHOD, or ::ATTRIBUTE directive.


Java

Using the C++ APIs, BSF4ooRexx was developed as a bidirectional Java bridge based on the Bean Scripting Framework. This bridge enables ooRexx to communicate with Java objects and Java to interact with Rexx applications. The bridge is realized by requiring the ooRexx package BSF.CLS, which defines public routines, classes and the environment symbol .BSF4REXX. Examples are provided for the use of Java classes in connection with AWT, Swing, JavaFX,
JDBC Java Database Connectivity (JDBC) is an application programming interface (API) for the Java (programming language), Java programming language which defines how a client may access a database. It is a Java-based data access technology used for Java ...
, Java 2D and some others./* create Java object */ frame=.bsf~new("javax.swing.JFrame", "Hello, my beloved world - from ooRexx!") frame~setSize(410,20) /* set width and height */ frame~visible=.true /* make JFrame visible */ call SysSleep 10 /* sleep for ten seconds */ ::requires "BSF.CLS" /* get Java support */ Based on BSF4ooRexx, interaction with Universal Network Objects (UNO), as used in OpenOffice and LibreOffice, is supported via the UNO.CLS package. The CLR.CLS package together wit
Jini4Net
enables the use of the .NET framework. Communication with processes via the D-Bus middleware under Linux is possible using the DBUS.CLS package. The JDOR.CLS package provides a command handler that leverages the Java2D classes (based on AWT) for graphics rendering. Based on the JDOR command handler, the experimental JDORFX.CLS package enables the rendering of 3D graphics using JavaFX 3D classes.


SQL

The ooSQLite class provides an interface to SQLite, an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. It allows interaction with several variants of SQL databases without having to change the script, but multi-threading is not supported. The external Rexx/SQL package enables access to SQL databases of different vendors via Open Database Connectivity (ODBC). With the goal of providing more functionality than a subset of ODBC and being thread-safe, the Rexx MySQL library provides a wrapper in C to add
MySQL MySQL () is an Open-source software, open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. A rel ...
support.


Windows automation

The Windows extension includes the Windows Script Host (WSH) Scripting Engine that can be used to perform general automation tasks. It also includes Object Linking and Embedding/
ActiveX ActiveX is a deprecated software framework created by Microsoft that adapts its earlier Component Object Model (COM) and Object Linking and Embedding (OLE) technologies for content downloaded from a network, particularly from the World Wide W ...
(OLE) support allowing to interact with Windows programs via the OLEObject. OLE Automation is an
inter-process communication In computer science, interprocess communication (IPC) is the sharing of data between running Process (computing), processes in a computer system. Mechanisms for IPC may be provided by an operating system. Applications which use IPC are often cat ...
mechanism developed by
Microsoft Microsoft Corporation is an American multinational corporation and technology company, technology conglomerate headquartered in Redmond, Washington. Founded in 1975, the company became influential in the History of personal computers#The ear ...
that is based on a subset of the Component Object Model (COM). This mechanism enables, among other things, the invocation of program functions, the querying and setting of attributes and the interception of component events. The ooRexx interpreter comes with examples that demonstrate OLE interaction with
Access Access may refer to: Companies and organizations * ACCESS (Australia), an Australian youth network * Access (credit card), a former credit card in the United Kingdom * Access Co., a Japanese software company * Access International Advisors, a hed ...
,
Word A word is a basic element of language that carries semantics, meaning, can be used on its own, and is uninterruptible. Despite the fact that language speakers often have an intuitive grasp of what a word is, there is no consensus among linguist ...
, Excel, OpenOffice/ LibreOffice, ActiveDirectory, WMI and other programs. Furthermore, a utility program for searching available OLE objects is included. exc = .OLEObject~new("Excel.Application") /* create object for Excel */ exc~visible = .true /* make Excel visible */ Worksheet = exc~Workbooks~Add~Worksheets /* add worksheet */ Worksheet~cells(1,1)~Value = “First Cell” /* insert string into cell */ In addition to OLE support, the Windows extension enables interaction with the Windows program manager, the system event log, the clipboard and the registry as well as to query, edit and interact with windows, menus or sub-menus.


Notes


See also

* Comparison of programming languages * Timeline of programming languages


References


Further reading

* * * * * *


External links


Rexx Language Association
* Open Object Rexx 5.1.0 documentation * Open Object Rexx on Sourceforge
Open Object Rexx WebsiteOpen Object Rexx on Rosetta Code
* BSF4ooRexx on Sourceforge * ooRexx Debugger on Sourceforge
Net-oo-Rexx
{{IBM FOSS Text-oriented programming languages High-level programming languages Multi-paradigm programming languages Class-based programming languages Object-oriented programming languages Structured programming languages Dynamically typed programming languages Free and open source interpreters Scripting languages IBM software Cross-platform software Rexx Programming languages created in 1988