[Contents]
[Prev] [Next] [Limbo Basics] [Limbo Programming] [Language Definition]

Function calls

The interpretation of an expression in the form:

term (expression-listopt)

depends on the declaration of the term. If it is the (perhaps qualified) name of an adt, then the expression is a cast; this is discussed in Casts. If the term is the (perhaps qualified) name of a function, the expression means a function call; this is discussed here.

A plain identifier as the term names a function defined in the current module or imported into it. A term qualified by using the selection operator . specifies a function member of an adt; a term using -> specifies a function defined in another module.

Function calls in Limbo create a copy of each argument of value type, and the execution of a function cannot affect the value of the corresponding actual argument. For arguments of reference type, execution of the function can affect the value of the object to which the reference refers, although it cannot change the argument itself. The actual arguments to a function are evaluated in an unspecified order.

Function calls can be directly or indirectly recursive; objects declared within each function are distinct from those in their dynamic predecessors.

Functions (see Function Types and Function Definitions) can either return a value of a specified type, or return no value. If a function returns a value, it has the specified type. A call to a function that returns no value can appear only as the sole expression in a statement (see Expression Statements).



[Contents]
[Prev] [Next] [Limbo Basics] [Limbo Programming] [Language Definition]

Copyright © 1998, Lucent Technologies, Inc. All rights reserved.