Subject: bug#49809: [PATCH] Add macro 'pcase-setq'

From: Stefan Monnier <[email-masked]>
Date: Sat, 07 Aug 2021 11:42:09 -0400

> Added with others.  Do you think that the added tests are sufficient?

The new code looks OK to me.  Just one thing, tho:

> +  (should (equal (list nil nil)
> +                 (let (a b)
> +                   (pcase-setq `(,a ,b) nil)
> +                   (list a b))))

The result is the same whether `pcase-setq` assigns nil or doesn't touch
the vars, so this test is not very effective.  I'd rather do:

    (should (equal (list nil nil)
                   (let ((a 'unset)
                         (b 'unset))
                     (pcase-setq `(,a ,b) nil)
                     (list a b))))

But Michael points out that it seems your code won't perform the
assignment if the pattern doesn't match, which I find to be an
odd behavior.

I'd expect a behavior like that of `pcase-let`, instead.

        Stefan