[plt-scheme] keyword arguments, take 2

From: Sam TH (samth at ccs.neu.edu)
Date: Thu Jun 14 15:12:13 EDT 2007

On 6/14/07, Eli Barzilay <eli at barzilay.org> wrote:
> On Jun 14, Sam TH wrote:
> > On 6/14/07, Eli Barzilay <eli at barzilay.org> wrote:
> >
> > > 3. Finally, for the multi-values bound to different names, you can
> > >    want the same without keywords:
> > >      (define (connect mode (host port)) ...)
> > >      (connect 'tcp ("localhost" 80))
> >
> > This is not the syntax of PLT Scheme as it currently exists - is
> > this something in Swindle? Or a new proposal for doing something
> > radically different with #%app?
>
> It's a fictional suggestion that is similar in spirit to the
> two-argument thing that Carl mentioned.  No real code involved.

But I know how to make Carl's suggestion work - if #%app sees a
parenthesized sequence starting with a keyword, then it passes all the
rest of the expressions, bundled up somehow, as a keyword argument to
the procedure.  The procedure then deconstructs them and binds them
appropriately.

How would your suggestion work?  How does #%app know not to try to
apply "localhost" to 80? How do we associate the symbol 'tcp with
those arguments, and those bindings, while still having 'udp
associated with other bindings (for example)?

-- 
sam th
samth at ccs.neu.edu


Posted on the users mailing list.