Subject: Re: bug#8415: 23.3.50; Extensible Emacs Registers

From: Stefan Monnier <[email-masked]>
Date: Fri, 08 Apr 2011 22:25:02 -0300

>> I think that's a better approach, yes (tho I'd pass the register object
>> to the functions, so instead of:
>> 
>> (let* ((object (register-get register))
>> (val (if (register-p object)
>> (register-info object)
>> object))
>> (jump (and (register-p object)
>> (register-jump-func object))))
>> (cond
>> (jump (funcall jump val))
>> 
>> you just have
>> 
>> (let* ((object (register-get register))
>> (jump (and (register-p object)
>> (register-jump-func object))))
>> (cond
>> (jump (funcall jump object))
>> 
>> or
>> 
>> (let* ((object (register-get register)))
>> (cond
>> ((register-p object) (funcall (or (register-jump-func object)
>> (error "Don't know how to jump"))
>> object))

> I am lost here. VAL is needed in the rest of the function, the old code.
> So you can't just omit it.

In the rest of the function register-p is false, so `val' = `object'.

>>> 1. all existing register-creating commands need to use the new
>>> implementation, so the patch won't be any smaller.
>> That's for subsequent patches.
> The intention is to have a clean uniform extensible internal
> representation of registers so subsequent patches are completely trivial
> which I opted to omit for now so that people can focus on more important
> changes. Somehow that didn't work out well.

The patches will be just as clean with the other approach.  Try it.

>>> 2. needs explicitly creating a register-value struct i.e.
>>> (register-set ?a (register-value-make ....)).
>> I see that as a feature.
> If register-value-make is not used, 'typecase polymorphism' has to be
> used. If we were to eliminate 'typecase polymorphism',
> register-value-make is required.

`typecase polymorphism' is what we have, and after the addition
I suggest we can remove it little by little.

> It just has selectors and three public function register-make,
> register-find, register-map. The rest of code can just build on top of
> them.

With the alist representation, register-find and register-map aren't
even needed.

        Stefan