This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: An optional arguments interface


>>>>> "Maciej" == Maciej Stachowiak <mstachow@mit.edu> writes:

Jim:
 >> DSSSL provides optional arguments as well, I believe with a syntax
 >> something like:
 >> 
 >> (lambda (a b #!optional c d . e) ...)

DSSSL has #!optional, #!key and #!rest (not, as Maciej said, `.',
which, incidentally, is the reason a lot of the functional-style slib
code won't work with it).  [This is Classic Dylan isn't it?]

 >> Given that someone has already invented a syntax for optional
 >> arguments in Scheme variants, which isn't substantially different
 >> in functionality from yours, I'd rather be conservative than
 >> promote yet another syntax.

FWIW there's also code for this functionality (Common Lisp influenced,
with normal Scheme lexicals) in the Scheme repository from Richard
O'Keefe and Bryan O'Sullivan.

 Maciej> * DSSSL isn't R4RS compatible for a number of reasons which are not
 Maciej> likely to change (e.g. no mutation), so preserving
 Maciej> compatability with it shouldn't be that high a goal,
 Maciej> certainly not as high as staying compatible with other Scheme
 Maciej> dialects.

At least Bigloo and Gambit currently support DSSSL syntax.

 Maciej> * Removing #! as the block comment token would break the
 Maciej> ability to specify an interpreter under Unix by putting
 Maciej> #!/usr/bin/guile on the first line, unless you special-case
 Maciej> that instance, which seems inelegant to me.

Elegance aside, other systems currently do special-case the first line
of loaded files that way (e.g. Gambit).

 Maciej> * Brackets are pretty universally understood to mean something
 Maciej> optional in a specifiction. I found it really cute to use
 Maciej> that for the declaration syntax as well.

Beware that brackets are used in several dialects -- optionally in SCM
AFAIR -- as an alternative to parens, though R4RS says they're
reserved for future extension.