DSSSL support

Bigloo supports extensions for the Dsssl expression language [Dsssl96]:

In addition, Bigloo extends DSSSL formal parameters. It supports #!rest argument following !key arguments. In that case, the #!rest formal parameter is bound to the list of non-keyword values.

DSSSL formal argument lists

Dsssl formal argument lists are defined by the following grammar:

<formal-argument-list> ⇒ <required-formal-argument>*
  [(#!optional <optional-formal-argument>*)]
  [(#!rest <rest-formal-argument>)]
  [(#!key <key-formal-argument>*) (#!rest <rest-formal-argument>?)]
<required-formal-argument> ⇒ <ieee-ident>
<optional-formal-argument> ⇒ <ieee-ident>
     | (<ieee-ident> <initializer>)
<rest-formal-argument> ⇒ <ieee-ident>
<key-formal-argument> ⇒ <ieee-ident>
     | (<ieee-ident> <initializer>)
<initializer> ⇒ <expr>
When a procedure is applied to a list of actual arguments, the formal and actual arguments are processed from left to right as follows:

It shall be an error for an <ieee-ident> to appear more than once in a formal-argument-list.

Example:

((lambda (x y #!rest z) z)
 3 4 5 6)                     (5 6)
((lambda (x y #!optional z #!rest r #!key i (j 1)) 
    (list x y z i: i j: j))
 3 4 5 i: 6 i: 7)             (3 4 5 i: 6 j: 1)
((lambda (x y #!optional z #!key i (j 1) #!rest r) 
    (list x y z i: i j: j r))
 3 4 5 i: 6 i: 7 8 9)         (3 4 5 i: 6 j: 1 (8 9))

Modules and DSSSL formal argument lists

Functions using Dsssl formal argument lists can be exported or imported in the same way as all regular Bigloo functions. When exporting such a Dsssl function the exact prototype of the function must be duplicated in the export clause. That is, for instance, the exportation prototype for the function:

(define (foo x y #!optional z #!key i (j 1)) ...)
is:

(export (foo x y #!optional z #!key i (j 1)))