[plt-scheme] passing-on keyword arguments

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Mar 18 19:55:30 EDT 2008

On Mar 18, Dimitris Vyzovitis wrote:
> On Tue, 18 Mar 2008, Eli Barzilay wrote:
> >
> > I think that I know how to make it easier, allowing something like
> > this:
> >
> >   (define (outer args ...)
> >     (+ (inner args ...) 5))
> >
> > to do the same, but it'll take some work to implement.
> 
> If you are about to embark on 'fixing' the keywords (as in make them
> easier to compose), can we get a form that captures straight keywords and
> an easier to use wrapper for keyword-apply?
> I was thinking something like this:
> (define (foo ... #:&rest kws)
>   (apply/kw bar kws))
> and
> (apply/kw bar (cons `(#:another-kw ,val) kws))

The advantage of the `...' thing above is that you don't get the
actual values, so it might be easier to implement things efficiently.
It's unclear whether what you want (which is available now, just more
verbosely) is worth adding new functionality for -- we might find a
solution that deals with most cases.  (The old `mzlib/kw' library made
just about anything possible, and many features where never used in
practice, AFAICT.)

In any case, if you run into such problems (in practice, not
pre-cooked examples), feel free to email (the list, or me directly).
It will help in looking for a good solution.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.