nil DNU #size

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

nil DNU #size

csrabak
In PharoDev (PharoCore1.0rc1 Latest update: #10502) evaluting this expression:

nil size. "Leads to a DNU Instances of UndefinedObject are not indexable"

For some reason, at some moment the #size overload of the Object>>size was taken off (w.r.t. Squeak).  This is weird because a lot of protocols that would work flawlessly (Null object pattern) now have to be patched for ifNil:[] or ifNotNil:[].

Also, Pharo coming from Squeak inheritance keeps the Object>>size implementation as:

size
        "Primitive. Answer the number of indexable variables in the receiver.
        This value is the same as the largest legal subscript. Essential. See Object
        documentation whatIsAPrimitive."

        <primitive: 62>
        self class isVariable ifFalse: [self errorNotIndexable].
        ^ 0

The version comment is "di 3/29/1999" so this is very old indeed.

This particular decisions is now making even the Luka's suggestion to do Gofer update itself to fail with a MNU. . .

Before I open an issue, I would like to know from the elder folks at the Pharo project if the decision to make this change in the accessing protocol of UndefinedObject was deliberated or we just stumbled a new bug?

--
Cesar Rabak

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project