On 3/30/2011 4:12, Eliot Miranda wrote:
Classes *don't* inherit from nil.  nil is at the end of their superclass chain.  That's different from inheriting.

At least in current images UndefinedObject includesBehavior: nil is false, which seems right to me.  nil is not a behavior; its use as the sentinel at the end of the superclass chain doesn't imply it is a behavior.  So I propose that we change includesBehavior:ThatOf: to something like

StackInterpreter methods for plugin primitive support
includesBehavior: aClass ThatOf: aSuperclass
"Return the equivalent of 
aClass includesBehavior: aSuperclass.
Note: written for efficiency and better inlining (only 1 temp)"
| theClass |
<inline: true>
aSuperclass = objectMemory nilObject ifTrue:
[^false].
theClass := aClass.
[theClass = aSuperclass ifTrue:
[^true].
theClass ~= objectMemory nilObject] whileTrue:
[theClass := self superclassOf: theClass].
^false

I don't think this will affect anything other than FFI and Alien since those are the only uses I can find, and in my reading of that code the proposed change seems fine; safer in fact.

Agreed?

Sounds reasonable to me. The one thing to check is if there are any places that currently assume that includesBehavior:ThatOf: returns true for a nil argument. If so, we can still add an explicit check that tests for interpreterProxy classAlien to be nil but I agree that the above would be the better solution.

Cheers,
  - Andreas