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

Function Arguments

If a function is to use arguments, it must declare variables that accept the values of the arguments. Arguments behave like other local variables inside the function and are created upon entry into the function and destroyed on exit.

Since Limbo is strongly typed, the compiler checks the argument types in the function declaration, in the function definition, and in the function calls. If any of these do not match, the compiler will complain.

Pass By Value, Pass By Reference

Due to Limbo's restricted use of pointers, there is no general call/pass by reference mechanism. Reference types are passed by reference, all other types are passed by value.

When data is passed by value, the receiving function creates an entirely new variable to hold the value of the argument passed to it. Modifications to the variable have no effect on the value in the calling function.

When data is passed by reference, the receiving function receives a reference, a pointer, to the value of the argument passed to it. Modifications made to the data also affect the value in the calling function.



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

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