unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: Help sought: Details of byte-compile-make-closure, please.
Date: Tue, 17 May 2022 08:33:09 -0400	[thread overview]
Message-ID: <jwvczgc9wsc.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <YoNnuXhb+eGgGzX9@ACM> (Alan Mackenzie's message of "Tue, 17 May 2022 09:15:37 +0000")

Alan Mackenzie [2022-05-17 09:15:37] wrote:
> Whilst fixing bug #55323, I came across more places in the byte compiler
> where we might need to strip positions from symbols.

[ Sidenote: I don't understand why you'd need to strip the positions
  manually here.  Is it for the `(apply #'make-byte-code ...` case,
  because your later position-stripping code doesn't recurse within
  byte-code functions?  ]

> (i) Does byte-compile-make-closure get called at all when
> lexical-binding is nil?

No.

> (ii) Is the ARG argument to make-byte-code, extracted from the parameter
> FORM always in the bit-encoded form (7 bits for minimum args, 7 bits for
> maximum args and 1 bit for &rest), or might it sometimes be an "old
> fashioned" list of symbols?

It's never the "old fashioned" list of symbols, because that's only
used for lexical-binding==nil functions as you can see in
`byte-compile-lambda` where we do:

	     (apply #'make-byte-code
		    (if lexical-binding
			(byte-compile-make-args-desc arglist)
		      bare-arglist)

> I need to know this because such a list
> might need positions stripping from these symbols.

Indeed.

> (iii) Is there ever a non-null interactive form contained in the
> parameter FORM?

Usually not, but sometimes yes.

> (If so, it comes in in a &rest parameter and is
> forwarded to make-byte-code in an &optional argument.)  Such an
> interactive form may need positions stripping from its symbols too.

FWIW, I think that is `byte-compile-lambda` strips the positions then
`byte-compile-make-closure` won't need to (since all the args, constant
vector, interactive form, ... comes from the byte code returned by
`byte-compile-make-closure`).

Oh, actually not quite: the `docstring-exp` needs to be stripped before
passing it to `eval`.


        Stefan




      parent reply	other threads:[~2022-05-17 12:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-17  9:15 Help sought: Details of byte-compile-make-closure, please Alan Mackenzie
2022-05-17 12:04 ` Eli Zaretskii
2022-05-17 12:33 ` Stefan Monnier [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvczgc9wsc.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).