the use of #pointsTo: (Re: Boolean expressions (was: Re: [squeak-dev] Re: Object>>#is:? (was: Re: PackageDependencyTest)))

Igor Stasenko siguctua at gmail.com
Thu Mar 4 21:43:22 UTC 2010


On 4 March 2010 23:23, Bert Freudenberg <bert at freudenbergs.de> wrote:
> On 04.03.2010, at 22:21, Stéphane Rollandin wrote:
>>
>>> If you have a lot of protocols you can use the super fast
>>> primitive supported #pointsTo: and have a lot cleaner (and possibly
>>> faster) code:
>>>
>>> is: aSymbol
>>>
>>>      ^#(Morph MySpecializedMorph FooMorph BarMorph) pointsTo: aSymbol
>>>
>>
>>
>> wow. thanks for the pointer, I wasn't aware of this one :)
>>
>> Stef
>
> It's also less readable. If you replace #pointsTo: with #includes: I know right away what it means. If you use this low-level optimization I have to think twice which object points where.
>

Yeah. Just a guess, we can add #identityIncludes: to Array
which will use same primitive as pointsTo:

Btw, i find it surprising that:

Array new pointsTo: Array

answering false.

An instance of class is always points to its class, no?

But its great, since we can use this 'bug/feature' to implement
#identityIncludes:  :)

> - Bert -
>


-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list