Subject: bug#45619: 28.0.50; pcase-let on MacOS doesn't work

From: Michael Heerdegen <[email-masked]>
Date: Thu, 07 Jan 2021 12:38:12 +0100

Stefan Monnier <[email-masked]> writes:

> Hmm... so-called "non-linear patterns".  We should emit a warning when the
> same var is used twice in a pattern, indeed, to avoid surprises.

Not sure if we speak about the same case.  I spoke about this: I caught
myself trying something like that:

(defvar thing-tag 'a-thing)

(let ((my-thing (cons thing-tag '(thing-contents...))))
  (pcase my-thing
    (`(,thing-tag . ,contents) (do-something-with contents))))

> I don't know what you mean by that.  Can you clarify?

Something diametral to my previous suggestion, I don't know if it would
be appropriate: You know scheme syntax rules and it's concept of
hygiene?  Similarly in `pcase' we could silently transform any
appearance of a SYMBOL with a fresh uninterned symbol.  While that would
not change the behavior for the common use cases, it would be clear that
bindings created by pcase would never interfere in any way with already
existing bindings of any kind.

The advantage would be clearer semantics.  The disadvantage would
be that we would limit the binding capabilities of pcase.

Being able to change the binding of a special variable sounds nice, but
I think that could also happen by accident, right?

Regards,

Michael.