all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen via "Emacs development discussions." <emacs-devel@gnu.org>
To: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <87ed9oe0ff.fsf@web.de> (raw)
In-Reply-To: ZlNVi8k59lVzkbnV@ACM

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.




  reply	other threads:[~2024-05-26 21:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-26 15:30 pcase generates an unprintable expansion for a form in test erc--restore-initialize-priors Alan Mackenzie
2024-05-26 21:19 ` Michael Heerdegen via Emacs development discussions. [this message]
2024-05-27 17:39 ` Stefan Monnier
2024-05-27 18:23   ` Stefan Monnier
2024-05-27 19:29     ` Michael Heerdegen via Emacs development discussions.
2024-05-27 19:42       ` Stefan Monnier
2024-05-29 15:39         ` Michael Heerdegen
2024-05-30 23:43           ` Stefan Monnier
2024-05-31  7:32             ` Andrea Corallo
2024-05-31 12:45               ` Stefan Monnier
2024-06-03 17:42           ` Stefan Monnier
2024-06-04  0:57             ` Michael Heerdegen
2024-05-27 20:14   ` F. Jason Park
2024-05-27 22:31     ` Stefan Monnier
2024-05-30 23:45 ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ed9oe0ff.fsf@web.de \
    --to=emacs-devel@gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.