Hi Bob,
On 02.07.2022 22:06, Bob Bridges wrote:
Rony, could you (or someone) say more about that? The ooRexx documentation has
a lot to say about messaging, which is a bit confusing to me because I first
got a handle on OOP in VBA and VBSCript, which do not.
VBA and VBS would allow referring to "third party (COM) objects" which can be seen as instances of
structures/classes. They allow for dereferencing structures/classes, refer to fields/attributes and
procedures/functions/methods (and invoke the latter) of such structures/classes. As
structures/classes can be nested one can use the dot to dereference further.
So VBA and VBS per se have not been object-oriented programming languages in the sense that they
would allow for defining (nested) structures/classes that they could instantiate; neither was
possible with VB (with the exception that Microsoft defined VB programs with forms to be classes
that can be instantiated) where today links usually refer to/cite VB.Net which is not VB.
VB.Net on the other hand, being a citizen of Microsoft's .NET/CLR framework allows for defining
explicitly classes. VB.Net gets compiled to the .NET bytecode CLI (a.k.a. MSIL), which also C# gets
compiled to and other such .NET/CLR languages.
If the big idea is messaging, does VBA do that and I just didn't notice? Or
are the VB flavors something different that don't do messaging, or not very
much?
VBA, VBScript, VB and VB.Net (also all other .Net/CLR languages) do not implement the message
paradigm (System.Message refers to message queuing).
If a language implements the message paradigm then it usually uses messages as first class objects
(FCO) sometimes making its functionality fully available to the programmer like ooRexx.
Here a small example:
a="... tsil niaM-MBI ,olleH"
say "1) BIF :" reverse(a) -- reverse BIF (built-in function)
say "2) message :" a~reverse -- sending a message to the string
value/object/instance
strMsg="reverse" -- define name of the message
say "3) a~send :" a~send(strMsg)-- send the message strMsg defines to the
string value/object/instance
msg=.message~new(a,"reverse")
say "4) msg~send:" msg~send
msg=.message~new(a,"reverse")
msg~start
say "5) msg~start, followed by msg~result:" msg~result
Comments:
1. normal REXX reverse BIF
2. ooRexx alternative: send the 'reverse' message to the string
object/value/instance
3. allow the message to be sent to be stored in the variable named "strMsg" and
sent via the
message "send" that each value/object/instance can understand (find the
method named like the
received message), reason being, that the ooRexx root class implements the
"send" method which
can therefore be always found due to inheritance; this adds a *lot* of
flexibility to the
language already
4. here the ooRexx .Message class gets used to create a value/object/instance
that defines the
receiver (the string value/object/instance referred to by the variable 'a')
and the message name
'reverse); this time the message gets sent off synchronically with the message
"send" which
means that execution blocks until the message returns with the result; this
adds a *lot* of
flexibility to the language as you may see
5. here the ooRexx .Message class gets used to create a value/object/instance
that defines the
receiver (the string value/object/instance referred to by the variable 'a')
and the message name
'reverse); this time the message gets sent off *Asynch*ronically with the Message
"start":
ooRexx will now create a new thread and have the message lookup execute on
another thread. In
order to fetch the result later we just need to send the 'result' message to
the message object;
this adds a *lot* of flexibility to the language as you may see.
Here the output of running the above program in ooRexx 5.0:
1) BIF : Hello, IBM-Main list ...
2) message : Hello, IBM-Main list ...
3) a~send : Hello, IBM-Main list ...
4) msg~send: Hello, IBM-Main list ...
5) msg~start, followed by msg~result: Hello, IBM-Main list ...
There is more to this, but you see among other things how easy it is in ooRexx to have messages
execute on separate threads if need be. You could even use the ooRexx .Alarm class to start a
message at a later time (e.g. in five minutes or at a certain date at a certain time like at the end
of July at 23:59) and being able to cancel it if it has not been sent yet.
---
The interesting thing is that the message paradigm allows for new, maybe more efficient problem
solutions for certain problems. E.g. while seeing my students having difficulties when creating Java
GUIs with awt/swing and with JavaFX, even if they were fully aware of the importance of interacting
with the GUI objects on the GUI thread, even if they knew about techniques how to achieve that, they
would get into problems when using larger programs with complex interaction patterns (which thread
is being used, if one would interact with object x versus object y). In the end I came up with a
solution for them that solved all GUI-thread problems once and forever since then and became part of
BSF4ooRexx: the easy solution is message based! :)
---rony
-----Original Message-----
From: IBM Mainframe Discussion List<[email protected]> On Behalf Of
Rony G. Flatscher
Sent: Saturday, July 2, 2022 15:05
Alan Kay is regarded to have coined the term "object-oriented programming
(OOP)" in the context of his work while at PARC. He is being cited on Wikipedia:
I'm sorry that I long ago coined the term "objects" for this topic because
it gets many people
to focus on the lesser idea. The big idea is "messaging".[8]
Cf.<https://en.wikipedia.org/wiki/Alan_Kay#cite_ref-8>.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN