|
send
+---------------+
V |
>>-send(messagename---+-----------+-+-)-----------------------><
+-,argument-+
Returns a result of invoking a method on the target object using the specified message name and arguments. The send() method allows methods to be invoked using dynamically constructed method names. The [messagename] can be a string or an array. If [messagename] is an array object, its first item is the name of the message and its second item is a class object to use as the starting point for the method search. For more information, see . Any [argument] s are passed to the receiver as arguments for [messagename] in the order you specify them. Object class - send method
world=.WorldObject~new
-- the following 3 calls are equivalent
msg1=world~hello("Fred")
msg2=world~send("HELLO", "Fred")
msg3=.message~new(world,"HELLO", "i", "Fred")~~send
say msg1 /* Produces Hello Fred 21:04:25.065000 */
/* for example */
say msg2 /* Produces Hello Fred 21:04:25.081000 */
/* for example */
say msg3~result /* Produces Hello Fred 21:04:25.101000 */
/* for example */
::class 'WorldObject' public
::method hello
use arg name
return "Hello" name time('L')
|