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

Tobias C. Rittweiler tcr at freebits.de
Tue Apr 6 07:36:32 UTC 2010


Nikodemus Siivola <nikodemus at random-state.net> writes:

> Never one to give up, I note that review cycle 2 is still on, and
> SWITCH &co are still on the operating table...
>
> Aside from the docstrings -- which are quick to fix once the semantics
> are settled-- I think the main questions are:
>
> * Should they evaluate clause keys or not?
>
> * If they evaluate keys, can one specify multiple keys per clause?
>
> * :KEY argument currently makes no sense, IMO, since (switch ((foo-bar
> foo)) ...) is more convenient than (switch (foo :key #'foo-bar) ...).
>
> * :TEST and :KEY meaning. What does (defun feh (equal) (switch (*foo*
> :test equal) ...)) mean?
>
> My current thinking is that evaluating keyforms is OK, as it makes it
> easier to write stuff like
>
>   (switch (foo :test #'equal)
>     (constant1 ...)
>     (constant2 ...))
>
> I'd be happy to live with non-evaluating keys as well, though.
>

I don't have time right now to consider anything else this issue.

In past, I suggested to have both: Zetalisp contained a SELECT macro
which was pretty much like SWITCH with evaluating keys, iirc.
Hence I suggest to have

  SWITCH, which does _not_ evaluate the keys (because of its C
  connotations)

and

  SELECT which does.


  -T.





More information about the alexandria-devel mailing list