<Core Language>

[ Parameter Mechanisms | Garbage Collection | Prototype Functions | service/session/seslet | Miscellaneous ]


Parameter Mechanisms

All assignments (including implicit assignments of actual parameters to formal parameters induced by function calls) involving basic types in <bigwig> are call-by-value. Those involving composite types are performed by copy-on-write, which is semantically equivalent to call-by-value, only much more efficient.


Garbage Collection

All values in <bigwig> are garbage collected when they are no longer live (reachable by program variables). This happens incrementally, automatically, and transparently via a built-in reference counting garbage collector.


Prototype Functions

<bigwig> is equipped with the possibility of interacting with functions written (externally) in C. This is done through prototype functions (i.e. function declarations with no body). Whenever the <bigwig> compiler encounters such a declaration, it will assume that the body of the function is provided by some C code. This can sometimes be useful, when constructions that are not directly provided by <bigwig> are needed. [See the getting started tutorial].


service/session/seslet

service
A <bigwig> program is also referred to as a Web service and begins with the keyword service. A service is comprised of a number of toplevel declarations plus a number of sessions.

session
Sessions are the entry points to the Web service, much like the main routine in C and Java programs. However, unlike C and Java programs, a <bigwig> service may have more than one session. A session contains a number of toplevel declarations plus a sequence of statements that is executed when the session is invoked (via a CGI request). This sequential action may at various points chose to interact with the client who invoked the session (almost reversing the roles of client and server), asking for values to be entered and submitted. Unlike CGI programs, <bigwig> sessions preserve the state across interactions. A session gives rise to a session thread (i.e. a process) on the Web server as depicted below:

Session Model

seslet
Seslets provide a more liberal interaction mechanism than that of the session centered model in which the client and server must strictly alternate between being active and suspended. There are two kinds of seslets; client-side and server-side seslets. A client-side seslet is a Java applet that can run in the browser and request information from the server-side seslets. For each service, the <bigwig> compiler generates the Java code for a superclass, itself a subclass of Applet. The programmer can then extend this Java class and use it to access the available server-side seslets. Server-side seslets are functions that can be invoked by client-side seslets in order to compute information or produce side-effects. Since Server-side seslets do not have a client, they are not allowed to show or exit documents.

If the client submits the current page, then the browser terminates all running client-side seslet applets. However, running server-side seslets are allowed to run until termination. This is necessary for instance to avoid breaking critical synchronization invariants.


Miscellaneous

getenv
This built-in function takes a string argument naming an environment variable and returns the (string) value of this variable.

random
This built-in function takes an int value and returns a (pseudo-) random int value between (including both end points) zero and the value given minus one.

system
This built-in function is similar to C's system function. It takes a string which is executed in a shell (sh) and returns the (integer) exit status produced by the shell. The path is the $SERVICEDIR/<<service-name>>. Use with caution!

Expression-Statements
Statements can now be embedded in expressions (exp ::= '(' compound_stm ')') as in Gnu C. The result is the value of the last statement if it is a statement-expression (stm ::= exp ';') and void otherwise.

typeof
This construct takes an expression in parentheses. The type of the construct is equal to the type of the expression. Note that the expression is solely used for determining the type and is thus never run. The construction is mostly intended for use via the syntax macros.


bigwig@brics.dk
Last updated: November 2, 2001
Valid HTML 4.01!