[plt-scheme] [dfelgar: Lisp-style keyword parameters]

From: Don Felgar (dfelgar at rainier-infosys.com)
Date: Mon Apr 21 00:32:26 EDT 2003

Never mind my earlier post.  On second look Swindle keywords are easy
to use.

----- Forwarded message from dfelgar -----

To: plt-scheme at list.cs.brown.edu
Subject: Lisp-style keyword parameters

I'm converting some Guile code to PLT.  I've used extensively the
Guile let-keywords operator which implements Lisp-style optargs.  For
example:

  (define (make-field name . args)
    (let-keywords args #f
        ((display-name name)
         (description #f)
         (required? #f)
         ...)
     ...))

allows

  (make-field "foo" :required? #t)
  (make-field "bar" :description "description for bar" :required? #t)

and so forth.

The only thing at all comparable that I've been able to find for PLT
is in the Swindle package, but I don't understand the macros there,
and I can't find an example of Swindle keyword usage.

Ideally I'd like to find a let-keywords for PLT, or something very
close to it.  I'm using keywords mostly in class constructors (slib's
yasos currently), so if PLT classes have a similar mechanism, that
might fulfill the role also.

Thanks
Don

----- End forwarded message -----


Posted on the users mailing list.