Getting Started Documentation Glish Learn More Programming Contact Us
Version 1.9 Build 1556
News FAQ
Search Home


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 ( val1, val2, ... )

expr1 -> [ expr2 ] ( val1, val2, ... )
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 expr2, 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 [*]) or calling functions (§ 6.4.1, page [*]). (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   Contents   Index
Please send questions or comments about AIPS++ to aips2-request@nrao.edu.
Copyright © 1995-2000 Associated Universities Inc., Washington, D.C.

Return to AIPS++ Home Page
2006-10-15