- Source: Object REXX
Object REXX is a high-level, general-purpose, interpreted, object-oriented (class-based) programming language.
It is a follow-on and a significant extension of the Rexx programming language (often called "Classic Rexx"). Object REXX retains all the features and syntax of "Classic Rexx" while adding full object-oriented programming (OOP) capabilities. Although Object REXX does not implement all aspects of the "Information Technology – Programming Language REXX" ANSI X3.274-1996 standard, it offers many new features of its own.
Following its "Classic Rexx" influence, Object REXX is designed to be easy to learn, use, and maintain.
Several object-oriented implementations of REXX are available, including Open Object Rexx ("ooRexx") and Rexx Object Oriented ("roo!").: 311
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. 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. 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.
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. In 1997, versions for Windows 95, Windows NT and Linux 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 Me, Windows 98 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 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) and Workplace Shell (WPS) support. The OS/2 version of Object REXX includes classes to support SOM and WPS. These are also included 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 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 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 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 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 an unofficial port to OS/2 also exists. For Intellij IDEA, the ooRexxPlugin adds support for syntax highlighting, syntax checking, code completion and documentation support modeled after Javadoc using annotations.
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 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.
= Instructions
=As in "Classic Rexx", there are assignment instructions, keyword instructions and command instructions, and in ooRexx there are also the directive instructions. In line with the desire to keep the language small, there are only thirty keyword instructions in ooRexx 5.0.0. Unlike many other languages, no keywords are reserved, so there is no need to memorize a long list of reserved words. In cases where the string is neither an assignment nor a keyword instruction, it must be a valid expression and is considered a command instruction, which causes the interpreter to evaluate the expression and pass the value 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 environments such as Bourne Shell, Bash, Z-Shell, Command Prompt, some editors and others, as well as intercepting errors.
= 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.
= Case-insensitive
=As "Classic Rexx", ooRexx is a case-insensitive programming language. The interpreter capitalizes all characters outside quotation marks before executing them. Because the cases do not need to be differentiated, fewer additional details need to be learned and frustrating syntax errors are avoided.
= 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.
= Message paradigm
=Similar to the messaging paradigm implemented by Alan Kay in Smalltalk, everything in ooRexx is an object that can be communicated with by sending messages naming a method. 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 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. This enables a literal understanding and reduces the learning effort for beginners. For example the strip method by default removes leading and trailing blanks. 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.
Features
ooRexx is designed to retain all the features of "Classic Rexx". It conforms with the ANSI standard for the Rexx language (X3.274-1996, “Programming Language Rexx”) to ensure cross-platform interoperability with other compliant implementations. Thus "Classic Rexx" programs typically run under ooRexx without any changes. This makes it easy to transport both program code and developer knowledge from "Classic Rexx" to ooRexx. To this, ooRexx adds all the features of OOP, such as subclassing, polymorphism, and data encapsulation. Further features include multiple inheritance via mixin classes. The interpreter includes the rexxc utility, which makes it possible to translate programs into base64 encoding, a source-less file that starts faster since the initial parsing 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.
= Classes and Methods
=In addition to the three instruction types of "Classic Rexx", ooRexx adds directive instructions that allow the explicit definition of classes, attributes and methods. Directive instructions are not executable, but define the execution environment, with the first directive marking the end of the executable part of a program. To make directive instructions readily recognizable, they are introduced with two consecutive colons (::). The ::CLASS directive causes the interpreter to define a new class, and the ::METHOD directive to define a new method. The ::ATTRIBUTE directive is used to define an accessor method that can retrieve or assign an object variable. With the EXPOSE instruction, the object variable is exposed to a method, while PARSE can be used to parse the parameter and assign it to a variable.
= 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. Concurrency can be achieved either with the REPLY keyword instruction, which causes an early return from a method while its remainder continues to execute in a new thread, with the GUARD keyword instruction, which can set a method as unguarded so that it can execute together with other methods of the same class, or by using the start method of the Object class, which causes the receiver to process the message in a separate thread.
= Tracing
=As in “Classic Rexx”, the TRACE keyword instruction and the built-in TRACE() function facilitate debugging, allow for control of the level of detail and enable interactive debugging at runtime. When interactive debugging, the interpreter pauses after most instructions that are traced. While multi-threaded programs can be traced, ooRexx 5.1.0 introduces as an addition the TraceObject class, which provides additional information such as the interpreter instance, the number of the thread on which the message is dispatched, and the state of the guard locks, allowing to judge which method is currently blocked.
Build-in functions and classes
While ooRexx is an extension of "Classic Rexx" with objects, classes and methods, the traditional build-in functions are still available and thus ensure compatibility. The ooRexx release 5.0.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 RexxUtil offers 29 cross-platform, 25 Windows-specific and four Unix-specific functions for manipulating system files, directories, classes and objects.
ooRexx 5.0.0 contains a total of 57 built-in classes, which are divided into the class groups Fundamental, Stream, Collection and Utility.
External libraries
Using the ::REQUIRES directive, external function packages can be integrated on a per program basis. This directive is placed after the main code section and allows access either to public classes and routines of a Rexx program or, by specifying the LIBRARY option, to external libraries. Such libraries are usually organized around domain-specific functions.
The Rexx extension library provides a class for reading and writing comma-separated values (CSV) files, for creating and processing JavaScript Object Notation (JSON) data and a sub-command environment that partially emulates a TSO/CMS environment. The RxSock library enables to incorporate TCP/IP protocols, while the RxFtp library specifically provides access to the file transfer protocol. The RxMath library offers advanced mathematical functions such as square root calculation, exponential function, logarithm, sine, cosine, tangent, arc sine and power calculation.
For Windows, ooRexx includes the OODialog framework allowing to produce Windows dialogs and therefore graphical user interfaces. The ooRexx interpreter is delivered with several example programs and function packages that demonstrate the use of this framework.
For POSIX-compatible operating systems, the nCurses class library enables the writing of text-based user interfaces using the ncurses programming library. The RxUnixSys library provides functions on most Unix systems for interacting with processes and threads, users and user groups, files and file systems and other.
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 bridge, which enables interaction between ooRexx and Java. Furthermore, classes are provided that enable the automation of Windows applications. The ooSQLite class provides an interface to SQLite, an in-process library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.
= 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 is a bidirectional Java bridge based on the Bean Scripting Framework that allows ooRexx to communicate with Java objects and enable 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 2D and some others. Based on BSF4ooRexx, interaction with Universal Network Objects (UNO), as used in OpenOffice and LibreOffice, is supported via the UNO.CLS package. In addition, the CLR.CLS package together with 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.
= 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 (OLE) support allowing to interact with Windows programs via the OLEObject. OLE Automation is an inter-process communication mechanism developed by Microsoft that is based on a subset of the Component Object Model (COM) and enables, among other things, the invocation of program functions, the querying and setting of attributes and the interception of component events. The ooRexx interpreter includes examples that demonstrate some features of WSH, interaction with Access, Word, Excel and other programs via OLE, and a utility to browse available OLE objects.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
REXX
NetRexx
References
Further reading
Ashley, W. David; Flatscher, Rony G.; Hessling, Mark; McGuire, Rick; Peedin, Lee; Sims, Oliver; Wolfers, Jon (2022). ooRexx Documentation 5.0.0 Open Object Rexx Reference (PDF). RexxLA.
Ashley, W. David; Flatscher, Rony G.; Hessling, Mark; McGuire, Rick; Peedin, Lee; Sims, Oliver; Wolfers, Jon (2022). ooRexx Documentation 5.0.0 Programmer Guide (PDF). RexxLA.
Ashley, W. David; Flatscher, Rony G.; Hessling, Mark; McGuire, Rick; Peedin, Lee; Sims, Oliver; Sims, Oliver; Wolfers, Jon (2022). ooRexx Documentation 5.0.0 Windows Extensions Reference (PDF). RexxLA.
Ashley, W. David; Flatscher, Rony G.; Hessling, Mark; McGuire, Rick; Peedin, Lee; Sims, Oliver; Wolfers, Jon (2022). ooRexx Documentation 5.0.0 Application Programming Interfaces (PDF). RexxLA.
External links
Rexx Language Association
Open Object Rexx 5.0.0 documentation
Open Object Rexx on Sourceforge
Open Object Rexx Website
Open Object Rexx on Rosetta Code
BSF4ooRexx on Sourceforge
Kata Kunci Pencarian:
- Daftar bahasa pemrograman
- Daftar istilah komputer
- Object REXX
- Rexx
- Windows Script Host
- List of object-oriented programming languages
- Ncurses
- Universal Network Objects
- List of programming languages by type
- List of programming languages
- IBM System Object Model
- Multiple inheritance