[squeak-dev] The Inbox: Kernel-cmm.1228.mcz

K K Subbu kksubbu.ml at gmail.com
Thu May 9 17:39:21 UTC 2019


Marcel,

You're right. I threw in an idea without stating it clearly.

Methods like Boolean>>isBoolean can (and should) still exist. But if 
every such class has to patch the object class its methodDict can 
explode in size. In 5.2alpha:

Object methodDict size 481
(Object methodDict keys select: [:k | k beginsWith: 'is']) size 61

Around 13% of Object's selectors are is<Class> check. Object DNU can 
decode this pattern and respond without having to explicitly add methods.

If a new class Foo is added, then its isFoo method can return true and 
isFoo message will respond properly on any object. But if isFoo check is 
frequent and affects performance, then we could add Object>>isFoo to 
speed it up. The DNU is a fallback.

Regards .. Subbu

On 09/05/19 12:07 PM, Marcel Taeumel wrote:
> Hi Subbu,
> 
> here, regular message sends are more flexible than using #isKindOf: (or 
> #includesBehavior:). Any class in the hierarchy can choose to answer to 
> "is*" messages. That's not that easy with #isKindOf:, which depends on 
> the subclass structure, which is hard to "fake" for a specific instance. 
> I suppose that overriding #isKindOf: would be possible but troublesome...
> 
> Here is more on this topic:
> http://forum.world.st/isKindOf-in-Morphic-code-tp4904890p4904965.html
> http://forum.world.st/isKindOf-in-Morphic-code-tp4904890p4904935.html
> 
> Best,
> Marcel
>>
>> Am 08.05.2019 18:10:52 schrieb K K Subbu <kksubbu.ml at gmail.com>:
>>
>> This can lead to an explosion in methods. How about catching the pattern
>> in DNU and returning true for isObject and false for any selector
>> matching 'is[A-Z]*' or the more specific 'is'?
>>
>> Regards .. Subbu
>>
>> On 08/05/19 11:27 AM, Marcel Taeumel wrote:
>> > +1 for consistency :-)
>> >
>> > We should add more tests for isNumber, isCollection, isBoolean ... to
>> > document the intended use.
>> >
>> > Best,
>> > Marcel
>> >>
>> >> Am 08.05.2019 01:36:16 schrieb commits at source.squeak.org
>> >> :
>> >>
>> >> Chris Muller uploaded a new version of Kernel to project The Inbox:
>> >> http://source.squeak.org/inbox/Kernel-cmm.1228.mcz
>> >>
>> >> ==================== Summary ====================
>> >>
>> >> Name: Kernel-cmm.1228
>> >> Author: cmm
>> >> Time: 7 May 2019, 6:36:01.955169 pm
>> >> UUID: 2fad2a41-3aec-4e22-b9e8-cce50f7f6808
>> >> Ancestors: Kernel-nice.1227
>> >>
>> >> Allow identification of instances of Boolean via #isBoolean.
>> >>
>> >> =============== Diff against Kernel-nice.1227 ===============
>> >>
>> >> Item was added:
>> >> + ----- Method: Boolean>>isBoolean (in category 'testing') -----
>> >> + isBoolean
>> >> + ^ true!
>> >>
>> >> Item was added:
>> >> + ----- Method: Object>>isBoolean (in category 'testing') -----
>> >> + isBoolean
>> >> + ^ false!
>> >>
>> >>
>> >
>> >
>>



More information about the Squeak-dev mailing list