Product Site

5.1.4.24. startWith

Returns a message object and sends it a start message to start concurrent processing. The object receiving the message messagename processes this message concurrently with the sender's continued processing.

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.

The arguments argument must be a single-dimensional Array instance. Any values contained in arguments are passed to the receiver as arguments for messagename in the order you specify them.

When the receiver object has finished processing the message, the message object retains its result and holds it until the sender requests it by sending a result message. For further details, see Message class method start.
Example 5.38. Object class — startWith method
world = .WorldObject~new
-- these calls are equivalent and produce "Hello World, I'm Fred!"
msg1 = world~startWith("HELLO", .Array~of("World", "Fred"))
msg2 = .message~new(world,"HELLO", "a", .Array~of("World", "Fred"))~~start
say msg1~result
say msg2~result

::class WorldObject
::method hello
  use strict arg place, name
  return "Hello" place", I'm"  name"!"