[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Replace trivial pcase occurrences in the Emacs sources
From: |
Stefan Monnier |
Subject: |
Re: Replace trivial pcase occurrences in the Emacs sources |
Date: |
Tue, 30 Oct 2018 23:09:15 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
>> LGTM, thanks. We could maybe give a hint about why, e.g. saying that
>> there are no guarantees about the order and number of times they are run.
> Are these the only restrictions?
I think so, yes.
> Are there even cases where side effects can still be relied on -
> e.g. in
>
> #+begin_src emacs-lisp
> (pcase EXPR
> ((and P1 (guard (prog1 t (setq x 15))) P2) BODY1)
> ...)
> #+end_src
>
> is it legitimate to assume that x has been set to 15 if BODY1 is
> evaluated (and P1 and P2 don't touch x)?
Yes: pcase doesn't look inside the `guard`s so in order to get to BODY1
it had to evaluate `(prog1 t (setq x 15))` at some point.
But some of the preds and guards of other branches (both before and
after the one of BODY1) may also be run before getting to BODY1.
Stefan
- Re: Replace trivial pcase occurrences in the Emacs sources, (continued)
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Alan Mackenzie, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Andy Moreton, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Clément Pit-Claudel, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Alan Mackenzie, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Clément Pit-Claudel, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Andy Moreton, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Michael Heerdegen, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Michael Heerdegen, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources,
Stefan Monnier <=
- Re: Replace trivial pcase occurrences in the Emacs sources, Alan Mackenzie, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Alan Mackenzie, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Andy Moreton, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Andy Moreton, 2018/10/29
- pcase-lambda usage [Was: Re: Replace trivial pcase occurrences in the Emacs sources], Garreau\, Alexandre, 2018/10/29
- Re: Replace trivial pcase occurrences in the Emacs sources, Van L, 2018/10/30
- Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/30
Re: Replace trivial pcase occurrences in the Emacs sources, John Wiegley, 2018/10/23
Re: Replace trivial pcase occurrences in the Emacs sources, Stefan Monnier, 2018/10/23