From: =?utf-8?B?VGlhcm7DoW4gw5MgQ29ycsOhaW4=?=
Subject: Documentation strings for class-slots
Date:
Message-ID: <m27j3eiofj.fsf@cascade.local>
Hi--
is there any (quasi-portable) way to extract doc-strings for
individual class slots? The hyperspec is terse:
This standard prescribes no means to retrieve the documentation
strings for individual slots specified in a defclass form, but
implementations might still provide debugging tools and/or
programming language extensions which manipulate this
information. Implementors wishing to provide such support are
encouraged to consult the Metaobject Protocol for suggestions about
how this might be done.
Has any consensus been reached?
--
Tiarnán
Tiarnán Ó Corráin wrote:
> is there any (quasi-portable) way to extract doc-strings for
> individual class slots? The hyperspec is terse:
>
> This standard prescribes no means to retrieve the documentation
> strings for individual slots specified in a defclass form, but
> implementations might still provide debugging tools and/or
> programming language extensions which manipulate this
> information. Implementors wishing to provide such support are
> encouraged to consult the Metaobject Protocol for suggestions about
> how this might be done.
>
> Has any consensus been reached?
Consensus, no, but (documentation <slot-definition> t) may work,
depending on the implementation:
CL-USER> (defclass foo () ((bar :documentation "a bar")))
#<STANDARD-CLASS FOO>
CL-USER> (mapcar (lambda (slot) (documentation slot t))
(sb-mop:class-slots (find-class 'foo)))
("a bar")
Cheers,
-- Nikodemus
········@yahoo.com (Tiarn�n � Corr�in) writes:
> is there any (quasi-portable) way to extract doc-strings for
> individual class slots? The hyperspec is terse:
>
> This standard prescribes no means to retrieve the documentation
> strings for individual slots specified in a defclass form, but
> implementations might still provide debugging tools and/or
> programming language extensions which manipulate this
> information. Implementors wishing to provide such support are
> encouraged to consult the Metaobject Protocol for suggestions about
> how this might be done.
>
> Has any consensus been reached?
Even MOP doesn't specify anything to retrieve the slot documentation:
http://www.lisp.org/mop/dictionary.html#slotd-mo-readers
So, the portable thing to do, is either to fetch the sources, or to
shadow defclass to add the functionality you need; something like in:
http://www.informatimago.com/develop/lisp/small-cl-pgms/ibcl.lisp
--
__Pascal Bourguignon__ http://www.informatimago.com/
PLEASE NOTE: Some quantum physics theories suggest that when the
consumer is not directly observing this product, it may cease to
exist or will exist only in a vague and undetermined state.
Pascal Bourguignon wrote:
> ········@yahoo.com (Tiarn�n � Corr�in) writes:
>> is there any (quasi-portable) way to extract doc-strings for
>> individual class slots? The hyperspec is terse:
>>
>> This standard prescribes no means to retrieve the documentation
>> strings for individual slots specified in a defclass form, but
>> implementations might still provide debugging tools and/or
>> programming language extensions which manipulate this
>> information. Implementors wishing to provide such support are
>> encouraged to consult the Metaobject Protocol for suggestions about
>> how this might be done.
>>
>> Has any consensus been reached?
>
> Even MOP doesn't specify anything to retrieve the slot documentation:
>
> http://www.lisp.org/mop/dictionary.html#slotd-mo-readers
That's incorrect. The MOP specifies that it should be possible to
retrieve the :documentation option for slot definition metaobjects via
documentation. See "Initialization of Slot Definition Metaobjects" in
the CLOS MOP spec.
Pascal
--
3rd European Lisp Workshop
July 3 - Nantes, France - co-located with ECOOP 2006
http://lisp-ecoop06.bknr.net/
Pascal Costanza <··@p-cos.net> writes:
> Pascal Bourguignon wrote:
>> ········@yahoo.com (Tiarn�n � Corr�in) writes:
>>> is there any (quasi-portable) way to extract doc-strings for
>>> individual class slots? The hyperspec is terse:
>>>
>>> This standard prescribes no means to retrieve the documentation
>>> strings for individual slots specified in a defclass form, but
>>> implementations might still provide debugging tools and/or
>>> programming language extensions which manipulate this
>>> information. Implementors wishing to provide such support are
>>> encouraged to consult the Metaobject Protocol for suggestions about
>>> how this might be done.
>>>
>>> Has any consensus been reached?
>> Even MOP doesn't specify anything to retrieve the slot
>> documentation:
>> http://www.lisp.org/mop/dictionary.html#slotd-mo-readers
>
> That's incorrect. The MOP specifies that it should be possible to
> retrieve the :documentation option for slot definition metaobjects via
> documentation. See "Initialization of Slot Definition Metaobjects" in
> the CLOS MOP spec.
Good. Sorry for the misleading assertion.
--
__Pascal Bourguignon__ http://www.informatimago.com/
"Klingon function calls do not have "parameters" -- they have
"arguments" and they ALWAYS WIN THEM."