[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Shrinking EIEIO objects
From: |
Eric Ludlam |
Subject: |
Re: Shrinking EIEIO objects |
Date: |
Thu, 01 Jan 2015 21:40:59 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 |
On 12/30/2014 12:59 PM, Stefan Monnier wrote:
Hi Eric,
I'd like to install something like the patch below into Emacs's master.
What it does (along with various other side changes) is shorten the
object header from 3 fields (the constant `object', the class name, and
an object "name" field) to just one (an interned symbol with an "eieio-"
prefix, referring to the class object).
This seems like a fine idea. A side effect is that the 'name' slot is
gone. There have received a questions about why there is a 'name' for
objects, and really the main thing was debugging. When you have piles
of objects around, naming them makes it much easier to see what is going
on. EIEIO objects have a short hand using a #<class name> format, and
when the various prin1 tools are enabled for edebug, that short hand is
used in place of the vector. This is critical when debugging semantic
databases where the vectors contain thousands of symbols.
Your proposed solution will enable the current source forge hosted
version of CEDET to keep going, just with warning messages, which seems
fine.
I can convert the sourceforge version CEDET to use make-instance
instead, which should be compatible before and after your change. Note
that your patch still needs to update the doc string (and presumably the
.texi file) for make-instance as the old notes about compatibility will
no longer be relevant.
Among the side things it does, I'd mention:
- add "eieio--" prefixes to a few more entities.
- use hashtables rather than obarrays.
- use closures instead of backquoted lambdas.
- use call-next-method in the various definitions of `clone'.
- redirect defmethods when called on an alias.
- use class objects (vectors) rather than class names (symbols) at more places.
These all seem like good things too.
While reading through the patch, there was a bunch of changes related to
doc strings and methods. The goal was if you used help on a method,
such as:
C-h f constructor RET
(or eieio-constructor in your patch)
it should list the core doc (generic) and doc for every class that has
it's own implementation and custom doc. I couldn't intuit from the
patch what might happen as some of the doc strings looked like they were
removed?
I hope this helps.
Eric
- Re: Shrinking EIEIO objects,
Eric Ludlam <=
Re: Shrinking EIEIO objects, Eric Abrahamsen, 2015/01/09