Function Calls
  > Home
v User Guide
    > Introduction
    > Hello World
    > Flow Control
    v Function Calls
       o Arguments
       o Argument list
       o Absolute arguments
       o Results
       o Context linking
       o Pass by reference
    > Authentication
    > Database access
    > Content Management
    > Remote Calling
    > Object-Oriented
    > Other Features
> Reference
> Portal Object
> Development Guide

sys Class
debug Class
Intrinsic Conversions
>> User Guide >> Function Calls <=  =>      <  1  >  
Function Calls

As mentioned earlier, "function" in BEE is like "procedure" in traditional sense because it does not work syntactically as a value (like a = func(b) as in other computer languages.)  Here are the main differences between BEE "function" and traditional one:

n        Argument list is specified in name-value pairs, not enclosed in a pair of small brackets.

n        Arguments are not positional.  Their order of appearance (in both declaration and calling) is not significant.

n        Arguments are all optional and do not need to be declared in the function declaration line unless you want to assign the argument with a default value.  (The function can check whether an argument value is available using the "isset" Conversion.)

n        Arguments are all passed by value.  If you want the change of an argument value to survive the function exit, the variable name should be passed and the variable that such name refers to should be declared "parent" (linked with the caller's scope).

n        Arguments are evaluated before being passed to a function unless when they are passed by "absolute" value (indicated by a '!' in front of the argument name in either the declaration line or the calling line.)

n        Variables (also called context or environment) inside the function are local except for those in system classes and those explicitly or implicitly declared "global" or "parent".

n        Results are made available via several special variables: result%function, status%function and message%function.  They are all arrays (as always), and are referenced in the parent's scope as result%funcname, status%funcname and message%funcname.

n        Function names will be converted to lowercase internally and therefore is not case sensitive.

Let's see another hello-world example:

function helloworld whosays="Somebody" {

   display '{arg%whosays} says "Hello World"<br>\n';



helloworld whosays="Bill Gale";  // Output: Bill Gale says "Hello World"

helloworld;  // Output: Somebody says "Hello World"



Previous Page       Next Page

Accsoft Computer Technology Pty Ltd     ABN: 98 065 617 549
PO Box 892, Epping NSW 1710         Level 1, Epping Office Park, 242 Beecroft Rd, Epping NSW 2121, Australia
Tel: Sydney - (02)98691668     National - 1300-881668         Fax: (02)98691866
© Copyright 2003 Accsoft Computer Technology Pty Ltd