[closer-devel] using a custom unbound slot marker
Pascal Costanza
pc at p-cos.net
Wed Nov 1 20:25:39 UTC 2006
On 30 Oct 2006, at 15:37, Gary King wrote:
> Hi Pascal,
>
> I thinking adding such a thing is a _good_ idea (we can add it to
> the new "standard")
>
> On Oct 30, 2006, at 7:40 AM, Pascal Costanza wrote:
>
>> I think it's a pity that the CLOS MOP doesn't just specify a
>> constant for this. Maybe I should add this to Closer to MOP...
>>
>
Hm, I have thought a little bit about this, and maybe it's not a good
idea after all.
It could be that the low-level machinery to detect unbound slots is
actually part of the MMU, or some other element at the machine level.
For example, in a machine that uses tagged values, unbound could be a
configuration of tag bits. In that case, "the" unbound value would
probably not exist as such. Something like slot-makunbound is then
indeed a better abstraction for this.
I am by far not an expert in hardware / cpu / mmu matters, so maybe
what I am saying here is pure nonsense. On the other hand, I wouldn't
be surprised if, say, Lisp Machines had some better way to deal with
unbound variables than using a constant value to represent them. And
I think we should leave the door open for such possible
implementations...
Having said that, almost all the implementations that I have checked
seem to use some constant for unbound slots. The only one that seems
to behave somewhat mysteriously is MCL.
An alternative to defining a constant for unbound slots would be to
add explicit functions for reading and writing them. In the end, we
should probably have the following set of functions:
standard-instance-access
(setf standard-instance-access)
standard-instance-boundp
standard-instance-makunbound
standard-class-access
(setf standard-class-access)
standard-class-boundp
standard-class-makunbound
funcallable-standard-instance-access
(setf funcallable-standard-instance-access)
funcallable-standard-instance-boundp
funcallable-standard-instance-makunbound
funcallable-standard-class-access
(setf funcallable-standard-class-access)
funcallable-standard-class-boundp
funcallable-standard-class-makunbound
The -class- versions would be there for slots
with :allocation :class. (I don't know what parameters they would
take, though. Probably just whatever slot-location returns, without
specifying further what it is that slot-location returns for slots
with :allocation :class...)
Any comments?
Pascal
--
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel, Programming Technology Lab
Pleinlaan 2, B-1050 Brussel, Belgium
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/closer-devel/attachments/20061101/e1c13450/attachment.html>
More information about the closer-devel
mailing list