unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* What does an OClosure look like?
@ 2023-02-24 22:08 Alan Mackenzie
  2023-03-01 18:46 ` Michael Heerdegen
  0 siblings, 1 reply; 3+ messages in thread
From: Alan Mackenzie @ 2023-02-24 22:08 UTC (permalink / raw)
  To: emacs-devel

Hello, Emacs.

I'm currently experimenting with the layout of lambda forms.  In doing
so, I've hit a cl-assert in oclosure.el.

I can't find a description of an oclosure in that source file, nor in
the section in the elisp manual.  By description, I mean what an
oclosure structure looks like in terms of conses and lists.

Without such a description, I'll be reduced to the difficult process of
working this out for myself.  Difficult, because oclosure.el is largely
written in (to me) obscure cl- facilities, with which I am not familiar.

Could somebody (?Stefan, perhaps) point me at the description I need,
please.

Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: What does an OClosure look like?
  2023-02-24 22:08 What does an OClosure look like? Alan Mackenzie
@ 2023-03-01 18:46 ` Michael Heerdegen
  2023-03-02 21:49   ` Alan Mackenzie
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen @ 2023-03-01 18:46 UTC (permalink / raw)
  To: Alan Mackenzie; +Cc: emacs-devel

Alan Mackenzie <acm@muc.de> writes:

> Hello, Emacs.
>
> I'm currently experimenting with the layout of lambda forms.  In doing
> so, I've hit a cl-assert in oclosure.el.

Maybe show your code.

> I can't find a description of an oclosure in that source file, nor in
> the section in the elisp manual.  By description, I mean what an
> oclosure structure looks like in terms of conses and lists.

AFAIU these are ATM more or less normal function values with some meta
data stored at some place that does not change the "behavior" (see
`oclosure-type') when funcalling the thing.

The cl related part implements the type handling and the
semantics of this "meta data" (accessors).

A byte code oclosure can't be described in terms of conses and lists of
course.  What's your use case so that these internal implementation
details matter?

Michael.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: What does an OClosure look like?
  2023-03-01 18:46 ` Michael Heerdegen
@ 2023-03-02 21:49   ` Alan Mackenzie
  0 siblings, 0 replies; 3+ messages in thread
From: Alan Mackenzie @ 2023-03-02 21:49 UTC (permalink / raw)
  To: Michael Heerdegen; +Cc: emacs-devel

Hello, Michael.

On Wed, Mar 01, 2023 at 19:46:41 +0100, Michael Heerdegen wrote:
> Alan Mackenzie <acm@muc.de> writes:

> > I'm currently experimenting with the layout of lambda forms.  In doing
> > so, I've hit a cl-assert in oclosure.el.

> Maybe show your code.

Er, the diff file is approaching 1000 lines at the moment.  ;-)

> > I can't find a description of an oclosure in that source file, nor in
> > the section in the elisp manual.  By description, I mean what an
> > oclosure structure looks like in terms of conses and lists.

> AFAIU these are ATM more or less normal function values with some meta
> data stored at some place that does not change the "behavior" (see
> `oclosure-type') when funcalling the thing.

> The cl related part implements the type handling and the
> semantics of this "meta data" (accessors).

> A byte code oclosure can't be described in terms of conses and lists of
> course.  What's your use case so that these internal implementation
> details matter?

I'm trying to change the layout of lambda forms.  This involves changing
the layout of oclosures.  In particular, I'm trying to add a field to a
lambda which identifies the enclosing defun or macro, so that this can
be output on backtraces.  Currently very little information appears on
backtraces about lambda functions.

I got where I needed to go a few days ago, but it cost several hours of
tedious source reading.  Oclosures also mess with the function Ffunction
in eval.c, which didn't make things easier.

Still I fixed the bugs I introduced.

Thanks for the reply!

> Michael.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-03-02 21:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-24 22:08 What does an OClosure look like? Alan Mackenzie
2023-03-01 18:46 ` Michael Heerdegen
2023-03-02 21:49   ` Alan Mackenzie

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).