On 09.01.2022 16:29, Seymour J Metz wrote: >> Well all of your languages miss the support for the message paradigm. > What do you mean by "the message paradigm"? How does it differ from sending > method invocation and response messages to objects?
The message paradigm as set forth by Smalltalk explicitly defines a class for messages, allows for intercepting messages, rerouting messages at the will of the programmer and much more, as messages themselves become objects that the programmer can interact with, if needed. ooRexx implements the message paradigm in full, something that is easily overlooked as usually it is not necessary to be aware of it. A REXX programmer may stick to REXX programs and still is able to use ooRexx to run them as ooRexx is a snap-in replacement which supports all of REXX and adds additional features. For anyone who is not acquainted to REXX or ooRexx the little ten page paper<https://epub.wu.ac.at/8118/> gives an introduction and explains the most important concepts. There is no need for more pages to make the language understandable and applicable for those who already know how to program (including Assembler, VB/VBA/VBA.Net, Python etc. programmers). In ooRexx messages in code can be identified by locating the message operator (tilde: ~). Classic REXX BIFs (built-in functions) like c2x(), reverse(), substr() etc. are available in ooRexx, but "behind the curtain" the implementation of each string BIF is organized in the "String" class/structure/type where the implementation resides in form of method routines that are named "c2x", "reverse", "substr" and the like. Usually this is not important to know if using REXX concepts only. In the context of this discussion however it allows for understanding how ooRexx works "behind the curtain": everything in ooRexx (like in Smalltalk) is an object (synonyms: value, instance). Conceptually a programmer communicates with objects by sending them messages as if objects were living things. The object receives the message and will start out to look for a method it possesses that carries the same name as the received message. Once the method is located, the object invokes it, supplying any arguments that may have been given with the message. If the method returns a value (object, instance), the object will return it to the caller. So in the caller the message expression will get replaced with the returned value. To see how this works an example in REXX (which ooRexx understands and is able to execute) and one in ooRexx: * REXX (and ooRexx) str="?yadot uoy era woh ,tsiL-MBI ,olleH" say reverse(str) /* reverse the string and show it */ * ooRexx (message style) str="?yadot uoy era woh ,tsiL-MBI ,olleH" say str~reverse /* reverse the string and show it */ Both yield the same result, here a rexxtry session (in this case on Windows 10): F:\work\svn\bsf4oorexx\trunk\bsf4oorexx\samples\clr\raffel>rexxtry REXX-ooRexx_5.0.0(MT)_32-bit 6.05 30 Nov 2021 rexxtry.rex lets you interactively try REXX statements. Each string is executed when you hit Enter. Enter 'call tell' for a description of the features. Go on - try a few... Enter 'exit' to end. str="?yadot uoy era woh ,tsiL-MBI ,olleH" ........................................... rexxtry.rex on WindowsNT say reverse(str) Hello, IBM-List, how are you today? ........................................... rexxtry.rex on WindowsNT say str~reverse Hello, IBM-List, how are you today? ........................................... rexxtry.rex on WindowsNT As you can see the results are identical. Here a version that first reverses the string, replaces commas with a blank in the string and then extracts the second word and displays it, using the same rexxtry session: say word(changestr(',',reverse(str),' '),2) IBM-List ........................................... rexxtry.rex on WindowsNT say str~reverse~changestr(',',' ')~word(2) IBM-List ........................................... rexxtry.rex on WindowsNT As one can have white space around the message operator one could use it to e.g. format the message version as: say str~reverse ~changestr(',',' ') ~word(2) IBM-List ........................................... rexxtry.rex on WindowsNT Once one is accustomed to the message paradigm it becomes easy to use it (and also to read the message version statements). --- One nice thing about this is the abstraction that goes with it: we as programmers do not need to understand how the implementation goes we only need to know which messages an object understands and then send it to it (the object has the knowledge and inventory to resolve it appropriately). --- However there is much more a full implementation of the message paradigm allows for, e.g. monitoring messages that get sent to an object, rerouting/forwarding messages to a different object, renaming the message, changing the message arguments, creating proper messages, sending messages synchroneously or asynchronously (multi-threading is built-in in ooRexx, just check out the Alarm class that allows one to send a message at a later time on its own thread) and more! -- One important thing though: if you have no need for these features do not use them! :) ooRexx uses these features all the time under the hood making it powerful and easy to use. --- The Windows version of ooRexx uses exactly this very message paradigm to camouflage all OLE-Windows applications as ooRexx, such that one merely sends ooRexx messages to ooRexx (proxy) objects/values (representing a Windows OLE/COM object like MS Excel) which actually cause the Windows methods, attributes, constants, events to be run/queried/set/emitted. This makes it truly simple to write programs that interact with Windows and Windows applications! The external ooRexx function package BSF4ooRexx does the same: this function package makes all of Java available to ooRexx on any platform and camouflages Java as ooRexx! This makes it truly simple to write programs that interact with Java classes/objects as we only need to deal with the ooRexx proxy object, sending it ooRexx messages! The external ooRexx function package dbusoorexx does the same for DBus on Linux (and if ported to MacOS and Windows also on those platforms): it camouflages the DBus message bus as ooRexx allowing one to send ooRexx messages to ooRexx objects that proxy/represent the DBus objects (on the system or session bus, even private buses). ... --- Given the ooRexx C++ API it is fairly simple to create external functions/routines for ooRexx! As mentioned in another post rxapi.pdf contains the documentation and if you installed ooRexx e.g. on Windows there is a sample that demonstrates how to go about it, cf. "samples/api/c++/external" (it contains the Makefiles for Windows and Unix=MacOS/Linux). What I did not mention there is, that the ooRexx C++ API allows for the creation of external methods (just study all of "samples/api/c++/external")! :) So you could create methods in native code with the ooRexx message paradigm semantics and functionality! The ooRexx C++ API even allows one to optionally store and retrieve CSelf which would be a reference to a C++ object, and much more! As you can see, if there should be need for adding external functions and/or methods to ooRexx, this can be done with the powerful and easy to use C++ API of ooRexx. As a matter of fact BSF4ooRexx and dbusoorexx are using those native C++ APIs allowing high speed and using all that is available in and via the C++ world. Again it is fairly straight-forward and easy to add external routines and external methods to ooRexx if need be. ---rony ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN