[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pcase generates an unprintable expansion for a form in test erc--res
From: |
Michael Heerdegen |
Subject: |
Re: pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors |
Date: |
Sun, 26 May 2024 23:19:16 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Alan Mackenzie <acm@muc.de> writes:
> The form being compared using pcase, although not tiny, is not all that
> big, and it would be easy to increase its size to cause it to violate any
> reasonable value of PRINT_CIRCLE.
Even worse: if you try to compile a file consisting of only this defun
(this is exactly one part of that test factored out):
#+begin_src emacs-lisp
(defun erc--restore-initialize-priors-1 (expansion)
(pcase expansion
(`(let* ((,p (or erc--server-reconnecting erc--target-priors))
(,q (and ,p (alist-get 'erc-my-mode ,p))))
(unless (local-variable-if-set-p 'erc-my-mode)
(error "Not a local minor mode var: %s" 'erc-my-mode))
(setq foo (if ,q (alist-get 'foo ,p) (ignore 1 2 3))
bar (if ,q (alist-get 'bar ,p) #'spam)
baz (if ,q (alist-get 'baz ,p) nil)))
t)))
#+end_src
with a slightly reduced `max-lisp-eval-depth' (from 1600 to 1000)
compilation fails.
> Would it be possible and a good idea to amend pcase such that it
> generates less deeply nested expansions for forms such as we have here?
I think this todo in pcase.el is related:
;; - try and be more clever to reduce the size of the decision tree, and
;; to reduce the number of leaves that need to be turned into functions:
> Or does anybody have any ideas how better to resolve the problem?
Apart from trying to work around it somehow, I don't.
Michael.
- pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors, Alan Mackenzie, 2024/05/26
- Re: pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors,
Michael Heerdegen <=
- Re: pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors, Stefan Monnier, 2024/05/27
- Re: pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors, Stefan Monnier, 2024/05/27
- Re: pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors, Michael Heerdegen, 2024/05/27
- Re: pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors, Stefan Monnier, 2024/05/27
- Re: pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors, Michael Heerdegen, 2024/05/29
- Re: pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors, Stefan Monnier, 2024/05/30
- Re: pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors, Andrea Corallo, 2024/05/31
- Re: pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors, Stefan Monnier, 2024/05/31
Re: pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors, F . Jason Park, 2024/05/27