[alexandria-devel] Re: Review cycle 2: SWITCH, ESCWITCH, and CSWITCH

Nikodemus Siivola nikodemus at random-state.net
Sat Jun 7 16:12:35 UTC 2008


On Sat, Jun 7, 2008 at 5:02 PM, Attila Lendvai <attila.lendvai at gmail.com> wrote:
>>  Documentation is insufficient: I don't see how someone can *know* how
>>  to use these from just reading the docstrings. That is easy to fix,
>>  however.
>
> my opinion is so different than the consensus, that it probably
> doesn't matter much in this respect... but i'd rather spend the same
> time on writing documentation on how to use slime or on shaping the
> code. this is for developers after all, if they don't know how to C-c
> RET or M-. then a docstring won't save them... :) imho.

I find docstrings pretty important for Alexandria, because without
them it is impossible to tell if behaviour X is a feature, bug, or a
random artifact of implementation. Since the intent has always been to
freeze ALEXANDRIA.1 into backwards compatibily mode, without
docstrings we cannot even reasonably talk about backwards
compatibility mode without being reduced to treating bugs as features.

...of course the situation is different for other libraries which are
more-or-less *intended* to be moving targets -- for Alexandria the
goal is to be an stable, immobile, boring, essential... and
documented. :)

> my docstring for switch would look like this: "Similar to CL:CASE but
> compares using a user supplied :test function." (if i was forced to
> write one for a 10-liner, that is... :)

Hah, even that would be much better then the current one. :)

>>  Finally, there is a question of style/consistency: unless I am
>>  mistaken, CLHS has no examples of macros with :TEST and :KEY
>>  arguments. Should the syntax be :TEST #'FOO, or :TEST FOO?
>
> switch (and other similar macros) support #'foo already. see
> EXTRACT-FUNCTION-NAME.

Yes, but

(defun foo (value test)
  (switch (value :test test)
     ...))

doesn't work right. EXTRACT-FUNCTION-NAME is too DWIM.

Cheers,

 -- Nikodemus



More information about the alexandria-devel mailing list