Subject: bug#50777: Dropping EIEIO from xref (for performance)

From: Dmitry Gutov <[email-masked]>
Date: Fri, 24 Sep 2021 18:32:39 +0300

On 24.09.2021 17:49, Stefan Monnier wrote:
>> That creates some incompatibility (third-party packages can't inherit from
>> 'xref-location' anymore, or use 'make-instance', 'oref' or 'with-slots' with
>> our values),
> 
> About that: it should be fairly easy to get `make-instance`, `oref`, and
> `with-slots` to work with cl-defstruct objects/classes.
> 
> This should be easy enough that we *could* potentially consider doing
> those changes "right away" (i.e. for Emacs-28).

Interesting point.

Not sure we really want to: I imagine the removal of the use of 
'make-instance' contributed to the overall performance improvement. If 
I'm right, discouraging of its use (for this particular purpose) in 
third-party code seems like a good idea.

> As for the inheritance, they can still inherit from `xref-location` but:
> - not with `defclass` (the subclass needs to be defined with `cl-defstruct`
>    instead).
> - they can't inherit from both `xref-location` and something else any more.

There is no 'xref-location' structure, it's only defined by generic 
functions. I think that's better.

'xref-location' has always been a class with empty definition.

One area of bigger concern is whether code compiled against the new 
version of Xref would work with the old one without recompiling (and 
vice versa). I guess for that to work we need to disable inlining on 
xref-item's accessors, at least. Maybe there's something else I'm missing.