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 12.2. Message object usage
/* 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."