[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: if-let/if-let*/and-let/..

From: Stefan Monnier
Subject: Re: if-let/if-let*/and-let/..
Date: Wed, 14 Feb 2018 22:37:51 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>  (if-let* (x) "dogs" "cats") => "cats"

We could detect this case and signal an error during macro-expansion for
it (the special (VAR EXP) form should be (VAR EXP) and not just

>  (if-let* (x (y 2)) "dogs" "cats") => (void-function y)

This is right.  If you presume that `if-let` only takes the same syntax
as `let`, then the above would be equivalent to 

    (if-let* ((x nil) (y 2)) "dogs" "cats")

which is just a complicated way to write


so it's rather unlikely that a user would write that on purpose.
It's much more likely that he meant

    (if-let* (x (y 2)) "dogs" "cats")

to be treated as

    (if-let* ((x (y 2))) "dogs" "cats")

which will indeed correctly give you the (void-function y).

>  (if-let* (x (y 1) (z 2)) "dogs" "cats") => "cats"

Same as the first case above, we could/should detect this case during
macro-expansion since this is not of the form (VAR EXP) but (VAR EXP EXP).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]