emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

User-reserved element in byte code vectors (was: Emacs Common Lisp)


From: Lars Brinkhoff
Subject: User-reserved element in byte code vectors (was: Emacs Common Lisp)
Date: 28 Apr 2004 12:43:23 +0200
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

[Cc to emacs-devel.  Context: It can be useful to store user-defined
objects in a byte code vector.]

Richard Stallman <address@hidden> writes:
>     The make-byte-code function takes any number of arguments, so it
>     already works.  The problem is that there's no guarantee that future
>     versions of Emacs won't start to use more than the first six elements.
> Now I see the issue.  We could decide to leave the 7th element
> unused, and document that.

Yes, that would be good enough for my purposes.  Obviously, when more
than one object needs to be stored, I can just put them in a list or a
vector and put that in element 7.

In my case, I frequently do want to store more than one object, so it
would be more efficient if there were more than one element available
in the code vector.  However, other than extending the above solution
to something ugly like "decide to leave the 7th, 8th, and 9th element
unused", I don't see a good way to do that.

Or maybe... How about defining a variable like this:

  (defvar byte-code-user-elements 6
    "The lowest index of elements in a byte-code object which a user may use.
     Elements below this index are used by Emacs.  Elements including and
     above this index may be used freely by a user (e.g. by calling
     make-byte-code); Emacs won't use them for any purpose.")

Then future versions of Emacs could raise this limit as needed.

-- 
Lars Brinkhoff,         Services for Unix, Linux, GCC, HTTP
Brinkhoff Consulting    http://www.brinkhoff.se/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]