* Raymond Toy <[EMAIL PROTECTED]> :
Wrote on Tue, 02 Dec 2008 20:23:45 -0500:

|> 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.
|
| I've implemented this already.  It basically does a check-type for (setf
| slot-value) for standard objects.  This doesn't change what happens when
| slot-value is used in a method.

I'm not sure this is a good idea.  (But I have not measured the cost of
the change, NOTE: I'm not objecting to the change)

| I don't follow why there should be a path that avoids the type check
| overhead. 

Performance.  If this is implemented in the compiler I can probably set
optimize levels to avoid an unnecessary runtime check-type from being
inserted.  Implementing it the way you impacts all calls regardless of
whether slot has a type declared or *use-slot-types-p* is nil --- even
though the functional result is the same.

Needless to say those applications which do a a large number of (common)
setf slot-values through this code path will be put through the few
extra instructions. :)

| I'm not sure, but it wouldn't surprise me some compiled methods behave
| strangely if the slot doesn't have the specified type.  (Untested,
| though.)

--
Madhu


Reply via email to