Object class.
To obtain a message object, an object sends a start
message to the object to which the message object will convey a message. The
message is an argument to the start message as in the following example:
a=p~start("REVERSE")
A, and sends it
a start message. The message object then sends the REVERSE message to object
P. Object P
receives the message, performs any needed processing,
and returns a result to message object A.
Meanwhile the object that obtained message object
A continues its processing. When message object
A returns, it does
not interrupt the object that obtained it. It waits until this object requests
the information. Here is an example of using a message object to run methods
concurrently. /* Example of using a message object */
object1 = .example~new
object2 = .example~new
a = object1~start("REPEAT",10,"Object 1 running")
b = object2~start("REPEAT",10,"Object 2 running")
say a~result
say b~result
say "Main ended."
exit
::class example
::method repeat
use arg reps,msg
do reps
say msg
end
return "Repeated" msg"," reps "times."