emacs-devel
[Top][All Lists]
Advanced

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

Slot accessing issues in EIEIO


From: Zhu Zihao
Subject: Slot accessing issues in EIEIO
Date: Wed, 06 May 2020 12:17:28 +0800
User-agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (Gojō) APEL/10.8 EasyPG/1.0.0 Emacs/27.0 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

This
thread(https://lists.gnu.org/archive/html/emacs-devel/2020-05/msg00674.html)
reminds me about some issues on slot accessing in EIEIO.

Recently, I'm reading the source of
closql(https://github.com/emacscollective/closql), A Emacs sqlite database ORM
package. It use eieio object, and put a piece of advice on eieio-oref to
intercept the reading slot action.

I don't think use an advice is the silver bullet. If different package put
different advice on the same function. The order of calling will make user
puzzled. There's slot-value-using-class for CLOS to handle slot accessing, but
there's nothing for EIEIO to do this.

Another question is, user may access the slot without the respect of eieio-oref 
via
another public interface, the eieio pattern in pcase. eieio pattern directly
access the slot index table to avoid useless type check. But another macro
with-slot, have to check for each binding because it use eieio-oref.

So I suggest to change the structure of eieio-oref. we can separate checking and
accessing into two different function. For macros bind multiple slots, checking
should be done once before accessing. And it's possible to introduce
slot-value-using-class generic in accessing function.

--
Zihao




reply via email to

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