GNU bug report logs -
#45619
No warning when pcase-let is binding dynamic variable
Previous Next
Full log
View this message in rfc822 format
Stefan Monnier <monnier <at> iro.umontreal.ca> 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.
This bug report was last modified 3 years and 114 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.