(i think i've already sent this, but it hasn't shown up on the list, sorry if you get it twice)
hi,
i recently needed (or just decided that i wanted it) a version of if-let with sequential binding. The bindings form is as with if-let, however to ensure that only the 'true' bindings are seen in the else form (and i'm not convinced this is worth it) the else form is repeated multiple times (once per binding) in the macro's expansion.
the docstring should explain how it works (and if not i'll fix the docstring).
and, since it made sense to me at the time, when-let and when-let* are implemented in terms of if-let and if-let* (instead of repeating the binding expansion and and code).
-- -marco
On 24 November 2012 18:59, Marco Baringer mb@bese.it wrote:
i recently needed (or just decided that i wanted it) a version of if-let with sequential binding. The bindings form is as with if-let, however to ensure that only the 'true' bindings are seen in the else form (and i'm not convinced this is worth it) the else form is repeated multiple times (once per binding) in the macro's expansion.
the docstring should explain how it works (and if not i'll fix the docstring).
and, since it made sense to me at the time, when-let and when-let* are implemented in terms of if-let and if-let* (instead of repeating the binding expansion and and code).
It seems very strange to me that you leave variables unbound in the ELSE branch -- so you can only refer to the first one.
Either all should be bound in the ELSE branch or non should be.
Otherwise no complaints -- and would be happy to merge. (Or if there's a rationale for the unboundness I'm happy to hear. It just isn't obvious to me.)
Cheers,
-- Nikodemus
alexandria-devel@common-lisp.net