<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
On 3/30/2011 4:12, Eliot Miranda wrote:
<blockquote
cite="mid:AANLkTinYOb2yXTRjWHwaSDBa4rr-iFPqBJDH81UB2mph@mail.gmail.com"
type="cite">Classes *don't* inherit from nil. nil is at the end
of their superclass chain. That's different from inheriting.
<div><br>
</div>
<div>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</div>
<div><br>
</div>
<div>StackInterpreter methods for plugin primitive support</div>
<div>
<div>includesBehavior: aClass ThatOf: aSuperclass</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>"Return
the equivalent of </div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>aClass
includesBehavior: aSuperclass.</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>Note:
written for efficiency and better inlining (only 1 temp)"</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>|
theClass |</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span><inline:
true></div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>aSuperclass
= objectMemory nilObject ifTrue:</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>[^false].</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>theClass
:= aClass.</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>[theClass
= aSuperclass ifTrue:</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>[^true].</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>
theClass ~= objectMemory nilObject] whileTrue:</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>[theClass
:= self superclassOf: theClass].</div>
<div><span class="Apple-tab-span" style="white-space: pre;"> </span>^false</div>
</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>Agreed?<br>
</div>
</blockquote>
<br>
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.<br>
<br>
Cheers,<br>
- Andreas<br>
<br>
</body>
</html>