* Naming conventions for eieio slot accessors
@ 2018-11-03 21:43 Fu Yuan
2018-11-04 15:14 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Fu Yuan @ 2018-11-03 21:43 UTC (permalink / raw)
To: emacs-devel
[-- Attachment #1: Type: text/plain, Size: 611 bytes --]
Hi,
I'm writing a package which takes advantage of eieio.
When defining classes, I couldn't figure out how to name
the accessors.
First, should I use prefixes? Second, if I use a prefix,
should I use a double dash (--) or single dash (-)?
Say I'm writing a package called uikit.el and I have a class
`uikit-view' with a slot `name'.
Should I write
(defclass uikit-view ()
((name
:accessor uikit--name-of)))
or
(defclass uikit-view ()
((name
:accessor uikit-name-of)))
or
(defclass uikit-view ()
((name
:accessor name-of)))
Thanks,
Sincerely, Yuan
[-- Attachment #2: Type: text/html, Size: 3112 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Naming conventions for eieio slot accessors
2018-11-03 21:43 Naming conventions for eieio slot accessors Fu Yuan
@ 2018-11-04 15:14 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2018-11-04 15:14 UTC (permalink / raw)
To: emacs-devel
> I'm writing a package which takes advantage of eieio.
> When defining classes, I couldn't figure out how to name
> the accessors.
The accessor is a function, so it should at least follow the same naming
convention as used by other functions (e.g. use a "uikit-" or "uikit--"
prefix depending on whether you want to announce it as private or not).
After that, I don't think there are many more conventions to follow
because it's not used very often, so it seems nobody's come up with
a clear convention yet. I guess you could follow the
"<typename>-<fieldname>" convention used in cl-defstruct.
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-04 15:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-03 21:43 Naming conventions for eieio slot accessors Fu Yuan
2018-11-04 15:14 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.