|
sendWith >>-sendWith(messagename,arguments)-------------------------------->< 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 and arguments. 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 . The [arguments] argument must be a single-dimension array instance. The values contained in [arguments] are passed to the receiver as arguments for [messagename] in the order you specify them. Object class - sendWith method
world=.WorldObject~new
// the following 3 calls are equivalent
msg1=world~hello("Fred")
msg2=world~sendWith("HELLO", .array~of("Fred"))
msg3=.message~new(world,"HELLO", "A", .array~of("Fred"))~~send
say msg1~result /* Produces Hello Fred 21:04:25.065000 */
/* for example */
say msg2~result /* 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')
|