next up previous contents index
Next: whenever Statement Up: Events Previous: Overview of Agent Interaction

Send Expressions

      Most of the important details about sending events were covered in the previous section, but this section includes some details that were missed in that overview. Send expressions have two   forms:

expression -> name ( valtex2html_wrap_inline15496, valtex2html_wrap_inline15498, tex2html_wrap_inline15512 )

exprtex2html_wrap_inline15496 -> [ exprtex2html_wrap_inline15498 ] ( valtex2html_wrap_inline15496, valtex2html_wrap_inline15498, tex2html_wrap_inline15512 )

In both cases Glish evaluates the expression to the left of the -> operator to see whether it's an agent. If not, an error is generated. Otherwise the name of the event is taken from   either name or by evaluating exprtex2html_wrap_inline15498, which must yield a string scalar. The following are equivalent:
    a->foo( 5 )
    a->["foo"]( 5 )

The second send-event form is quite flexible. Here, for example, is one way to send a three events, foo, bar and bletch, with values of 1, 2, and 3:

    for ( i in 1:3 )
        a->["foo bar bletch"[i]]( i )

    The value of the event is taken from the various val's. If you specify just one val then that's the event's value. If you don't list any val's then the event's value is F. If you give more than one val then Glish constructs a record from the val's. In this latter case usually the val's are given names, using the same name = expression syntax as when creating records (§ 3.4.1, page gif) or calling functions (§ 6.4.1, page gif). See § 7.3 for examples of sending events.

Depending on the context in which the send expression occurs, a result value may be required from the agent, e.g.

    print a->foobar( action="show all" )
here print requires a result value. There are a few salient points regarding these send expressions which require a result:

 


next up previous contents index
Next: whenever Statement Up: Events Previous: Overview of Agent Interaction

Thu Nov 13 16:44:05 EST 1997