[alexandria-devel] multiple values in switch clauses
hi, i'd like switch to, just like case and typecase do, allow multiple values in the 'value' position of the condition: (switch (foo) ((bar baz) ...)) So the attached patch checks for the key form being a cons and, if so, expands into a (member value :test test) instead of (test value) form. Of course, this means that your key values can no longer be forms, so this may break existing code. I don't have any code which actually uses a function call in the value form of the clause (and a quick grep over my locally installed lisp libs shows nobody else does either), so i'm ok with the change, but i can understand if others don't agree. -- -marco
On 22 November 2012 10:02, Marco Baringer <mb@bese.it> wrote:
hi,
i'd like switch to, just like case and typecase do, allow multiple values in the 'value' position of the condition:
(switch (foo) ((bar baz) ...))
So the attached patch checks for the key form being a cons and, if so, expands into a (member value :test test) instead of (test value) form. Of course, this means that your key values can no longer be forms, so this may break existing code. I don't have any code which actually uses a function call in the value form of the clause (and a quick grep over my locally installed lisp libs shows nobody else does either), so i'm ok with the change, but i can understand if others don't agree.
I think I like the idea of a multiple-value-switch, but I'm constantly (well, every 6 months) to remove switch and rewrite it, so I'm a bit hesitant to add more features to it... Thinking about this. Feel free to kick me to remind me. Cheers, -- Nikodemus
Nikodemus Siivola <nikodemus@random-state.net> writes:
I think I like the idea of a multiple-value-switch, but I'm constantly (well, every 6 months) to remove switch and rewrite it, so I'm a bit hesitant to add more features to it...
do you want to get rid of it completely (i'd be rather confused if you did) or are you just unhappy with the current implementation? (if that's the case, then i'd be more than happy to try a rewrite of it) -- -marco
On 26 January 2013 18:21, Marco Baringer <mb@bese.it> wrote:
Nikodemus Siivola <nikodemus@random-state.net> writes:
I think I like the idea of a multiple-value-switch, but I'm constantly (well, every 6 months) to remove switch and rewrite it, so I'm a bit hesitant to add more features to it...
do you want to get rid of it completely (i'd be rather confused if you did) or are you just unhappy with the current implementation? (if that's the case, then i'd be more than happy to try a rewrite of it)
Unhappy with the details of the current implementation. I don't remember my grievances offhand, but looking in the list archives should locate them. Wanting to first remove it so there's no silent breakage due to changing semantics. Cheers, -- Nikodemus
participants (2)
-
Marco Baringer
-
Nikodemus Siivola