libera/#commonlisp - IRC Chatlog
Search
8:35:33
pve
Hi, is it allowed to do (with-accessors ((name symbol-name)) 'foo (print name))? Of course doing that is silly, but it's not clear to me if it's forbidden, by reading the hyperspec page.
8:38:44
pve
the page talks about slots, accessors and instances, but does any of that apply to a symbol?
9:06:20
beach
Although the "Notes" section is not normative, you can see in the WITH-ACCESSORS dictionary entry that it expands to a SYMBOL-MACROLET, so there is no reason why it wouldn't work for SYMBOL-NAME.
9:44:02
mfiano
It is just anything that accesses, which is also defined to attempting to read or write a place
9:51:43
aeth
getter and/or setter... or in CL-specific terms, reader and/or writer. It's just that the latter is almost always via SETF.
9:53:41
aeth
Where WITH-ACCESSORS won't work is when you need more than one argument, e.g. an AREF, which is definitely an accessor. (* technically, you could use it on an AREF of 0D arrays because those have no index)
10:02:12
mfiano
It's interesting to think about how you can have a SETF-named function or method specialized to a class, that is not considered an accessor (by just returning something irrelevant and not reading from or writing to a place), or to have a class with a slot having only a :reader for its slot specifier, having a true accessor defined with it.
10:42:14
jcowan
fwiw, I do not believe in "the essence of X" arguments where X is a (programmable) programming language. They are like discussions of the essence of humanity: nobody agrees, nor should they.
10:54:27
_death
pve: your assumption was correct, as far as I can tell.. it was meant for standard-objects.. it was invented as part of CLOS (I believe to address some silly criticism).. the replies you got seem to ignore that context though
11:06:09
_death
(in fact symbol-macrolet also came from the CLOS group, but proposed independently of CLOS.. the two CLOS macros with-slots and with-accessors make use of it.. the former macro makes sense to me, but I think the latter one should not have been introduced)
11:16:35
_death
correction: apparently it was not proposed independently, but taken in as part of CLOS
11:30:33
_death
symbol-macrolet started out as a macro with code walking support in PCL and later changed into a special operator
11:33:25
_death
interestingly it was controversial.. one suggested to remove it and make with-slots/with-accessors special operators instead (ouch).. Steele mocked it with a number-macrolet.. lucky for us sanity prevailed