[plt-scheme] Keyword argument refactoring comments

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Jul 25 19:40:28 EDT 2008

At Fri, 25 Jul 2008 11:59:40 -0500, "Grant Rettke" wrote:
> I've been reading bits and pieces of the new document for 4.x. I see
> that in Slideshow, there is now one convenient slide function 'slide'
> with keyword arguments for everything.
> 
> Did you enjoy cutting it over to using keyword arguments?

I find Slideshow much nicer to use with keywords, but I haven't yet
written many slides with v4.

> Did you ever find places where you thought keywords would be great,
> but then turned out to be a bad idea?

I think there were a couple of cases like that; unfortunately, I've
forgotten them. They may have been cases where by-position optional
arguments worked better, as Noel suggests.

Also I was relatively conservative in using keywords, so I can more
easily point to places where I decided not to convert, though it might
work:

 * `vl-append' is still `vl-append'; it's not `append' with an
   `#:alignment' keyword followed by 'left, or `#:left' keyword, or
   anything along those lines.

 * Similarly, it's still `lc-superimpose', and not `superimpose' with
   keywords to specify vertical and horizontal alignment.

My rationale here is that there are a small number of combinations, and
it's better to have the free-variable checking you get from embedding
part of the operation's configuration in the function name. I might be
wrong.

> Have you got any utilization of keyword argument idioms?

I think all my uses are in the category "configuration where a default
usually works".


Matthew



Posted on the users mailing list.