mit-scheme-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MIT-Scheme-devel] named parameters


From: Taylor R Campbell
Subject: [MIT-Scheme-devel] named parameters
Date: Wed, 8 Jun 2011 21:50:02 +0000
User-agent: IMAIL/1.21; Edwin/3.116; MIT-Scheme/9.1

I have never liked Common Lisp's mechanism for named parameters,
reflected in Dylan and various Schemes, so I was pleased to learn the
other day that the Racket folks have worked out a realization of the
general idea I have long thought would be better.  Instead of passing
keywords and their arguments as positional arguments and then parsing
the positional arguments, treat positions as numeric labels for
parameters and expand the set of labels to include symbolic labels.

I hacked up a proof-of-concept implementation for MIT Scheme at
<http://mumble.net/~campbell/tmp/mit-keyword.scm> (with apologies to
the mailing list archive).  Internally, this implementation uses
positional arguments to pass the arguments (but not the names) of
named parameters, and uses a linear scan to match parameter names with
argument names and to handle defaulting of optional parameters.

For most applications, the matching could happen at link-time like we
do uuo-link trampolines.  There is no overhead for lambdas or calls
that involve no named parameters, and with uuo-link trampolines there
would be no overhead incurred by the use of named parameters rather
than positional parameters for most applications.

Any comments?  I don't plan to integrate it into the system any time
soon, but it might be nice to do some day when we have less broken
macros and modules, like Racket.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]