Email list hosting service & mailing list manager

Alternative formulations of keywords John Cowan (11 Apr 2006 22:35 UTC)
Re: Alternative formulations of keywords Marc Feeley (12 Apr 2006 01:58 UTC)
Re: Alternative formulations of keywords John Cowan (12 Apr 2006 02:54 UTC)
Re: Alternative formulations of keywords Per Bothner (12 Apr 2006 03:05 UTC)
Re: Alternative formulations of keywords John Cowan (12 Apr 2006 03:12 UTC)
Re: Alternative formulations of keywords Eli Barzilay (12 Apr 2006 03:17 UTC)
Re: Alternative formulations of keywords Eli Barzilay (12 Apr 2006 03:20 UTC)
Re: Alternative formulations of keywords John Cowan (12 Apr 2006 03:27 UTC)
Re: Alternative formulations of keywords Per Bothner (12 Apr 2006 03:20 UTC)
Re: Alternative formulations of keywords Marc Feeley (12 Apr 2006 04:20 UTC)
Re: Alternative formulations of keywords John Cowan (12 Apr 2006 04:32 UTC)
Re: Alternative formulations of keywords Marc Feeley (12 Apr 2006 05:11 UTC)
Re: Alternative formulations of keywords John Cowan (12 Apr 2006 12:16 UTC)
Re: Alternative formulations of keywords Eli Barzilay (12 Apr 2006 12:29 UTC)
Re: Alternative formulations of keywords Marc Feeley (12 Apr 2006 13:07 UTC)
Re: Alternative formulations of keywords John Cowan (12 Apr 2006 13:36 UTC)
Re: Alternative formulations of keywords Marc Feeley (12 Apr 2006 14:25 UTC)
Re: Alternative formulations of keywords John Cowan (12 Apr 2006 14:28 UTC)
Re: Alternative formulations of keywords Marc Feeley (12 Apr 2006 14:57 UTC)
Re: Alternative formulations of keywords John Cowan (12 Apr 2006 16:26 UTC)
Re: Alternative formulations of keywords Per Bothner (12 Apr 2006 16:49 UTC)
Re: Alternative formulations of keywords John Cowan (12 Apr 2006 16:56 UTC)
Re: Alternative formulations of keywords Eli Barzilay (12 Apr 2006 13:37 UTC)
Re: Alternative formulations of keywords Marc Feeley (12 Apr 2006 04:54 UTC)
Re: Alternative formulations of keywords John Cowan (12 Apr 2006 16:07 UTC)

Re: Alternative formulations of keywords John Cowan 12 Apr 2006 16:07 UTC

Marc Feeley scripsit:

> >What are the use cases for computed keywords?
>
> Here are a few use cases.
>
> 1) You want to write a trace facility to help show the function calls
> and returns that are performed.  On entry you want to print the
> arguments of the function and the result on exit.  So you write this
> higher order function:

[snip]

> 2) You just got hold of this nice graphics library which has many
> functions accepting named optional parameters:

Both of these will clearly work, mutatis mutandis, with my #2, since
it's easy to rewrite the second example in terms of constructing a new
a-list of arguments and then invoke it as such.

Indeed, it is more convenient to do so, since given a well-defined
representation such as an a-list, the use of keywords in procedure
calls is decoupled from the use of keywords in lambda lists: you can
use keywords to invoke any procedure that expects a a-list as its last
argument, and you can invoke any procedure expecting keywords by using
an a-list (and must do so if you are invoking it other than with the
syntax of procedure call).

> Unfortunately your students are french and don't know english too
> well so you would like to translate the keywords into french to make
> the code easier to read.

Now if you wanted this to work:

(define largeur: width:)
(rect x y largeur: 100)

then you would need computed keywords indeed.  (This would require an
extension to the SRFI such that keywords can be redefined from their
default self-values, but that's a small point.)  But as long as you
don't demand non-lexically-apparent keywords in procedure-call syntax,
you don't need computed keywords in the full CL sense.

--
Business before pleasure, if not too bloomering long before.
        --Nicholas van Rijn
                John Cowan <xxxxxx@ccil.org>
                    http://www.ccil.org/~cowan