This is a reply to
http://groups.google.com/group/comp.lang.lisp/msg/38106dde37c4801c
Lars Rune Nøstdal wrote:
> I use (c-of (b-of a)), but it's more common to use or say (c (b a)).
You're doing right. I was looking for something like that and your
solution is ok.
If we always wrote simply
(defclass a () ((b :accessor b)))
at one point we would have a conflict.
Consider
cl-user> (defclass a () ((list :accessor list)))
Error: LIST is defined as an ordinary function #<function LIST
20BDCBB2>
We might admit a more libral policy:
(defclass lisp () ((b :accessor b) (list :accessor list-of)))
In this way we could not tell accessor name from slot name. And even
would not say by symbol name, is it an accessor or not. Using a-of
creates a namespace for all accessors.
There is a second advantage: accessor might be a wrapper, which
would do some more actions other than simple transforming a place.
In this case, we would be interested to find where
(slot-value a 'b) is used for direct access to a slot value.
So we'll be looking for just b.
If we had an accessor named b, grep would return us all the references
to accessor.
This is OOP... Looks like private slots with public accessors.
Privacy is not supported by a language, but if its violation can be
found easily, this is not a big broblem.
So I don't criticize you for that (a-of). Quite the reverse, it is
fine in a context of a lisp, and I'll accept this for my further
practice.
On 2008-11-06, budden <········@mtu-net.ru> wrote:
> But (a. (b. c) might be more fair
Except that it's easily confused for dot notation:
(a . (b . c))
> (a . (b . c))
Maybe, though i don't find it too confusing. There is a notable visual
difference.
Also, in most cases of such a miscpint, compiler would warn. For those
who do find this
confusing, pascalish (a^ (b^ c)) would may be acceptable then.