Subject: bug#8415: 23.3.50; Extensible Emacs Registers

From: Leo <[email-masked]>
Date: Thu, 07 Apr 2011 11:13:49 +0800

On 2011-04-06 23:38 +0800, Stefan Monnier wrote:
> 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.

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

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

For me, (register-make ...) is just simpler. One of the reasons that the
first patch I posted to emacs-devel evolved to the one I submitted in
this bug report.

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.

Leo