1 Dec 2008 16:50
Re: When slots :type are used
Raymond Toy <raymond.toy <at> ericsson.com>
2008-12-01 15:50:44 GMT
2008-12-01 15:50:44 GMT
>>>>> "Nicolas" == Nicolas Neuss <neuss <at> math.uni-karlsruhe.de> writes:
Nicolas> Raymond Toy <toy.raymond <at> gmail.com> writes:
>>> (defmethod setslot ((foo foo) val)
>>> (setf (slot-value foo 'a) val))
>>>
>>> (setslot *object* 3.5) ;; triggers a type error
>>>
>>> Can somebody provide a rationale for this ??
>>>
>> Most likely because no got around to doing it. Plus the most
>> interesting/most common case is probably in a method.
Nicolas> Wasn't this introduced by Gerd Moellmann's PCL improvements? I remember
Yes, Gerd made these changes.
Ray


> | Most likely because no got around to doing it. Plus the most
> | interesting/most common case is probably in a method.
> |
> | I'll see what I can do, but I know very little about the pcl
> | implementation.
>
> It may also have been a tradeoff, [since it is not being done in the
> compiler] and you want to have at least one path available to the
> programmer to set a slot value that avoids overhead of a type check.
But doing so by making (setf (slot-value))'s behavior different (shall
I say inconsistent?) depending on the context feels somewhat weird to
me. I guess you concern is performance here; but then, we can play with
the optimize declaration.


RSS Feed