[plt-scheme] keyword arguments (in v4.0, maybe)

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Jun 12 17:47:24 EDT 2007

At Tue, 12 Jun 2007 17:41:02 -0400, Matthias Felleisen wrote:
> 2. Say you provide some package based on PLT version 5.3. A bunch of  
> people like your package and import it. Now you discover that your  
> function f, nicely defined with two args could benefit from two  
> optional keyword args and so you change from
>    #module big
>      (define (f x y) ...)
> to
>    #module big
>       (define (f x y #:left 8 #:right 72) ...)
> No client package should have to notice anything and should work as  
> is. After all, you have introduced opt keyword-based args. But the  
> apply problem may necessitate a change to clients.
> Perhaps I misunderstood the problem, but so has Eli then.

Yes, you and Eli have misunderstood (I guess our messages crossed),
presumably because I explained it wrong.

I see that I originally wrote:

 One drawback of this strategy is that `(lambda args (apply f args))' is
 not an all-purpose wrapper strategy, because that only works for `f'
 that doesn't take keyword arguments.

The "take" should have been "require". That is, `apply' still works for
procedures that have optional keyword arguments. But it doesn't work
for procedures that require some keyword arguments.


Posted on the users mailing list.