The Inbox: Kernel-cmm.1228.mcz

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

The Inbox: Kernel-cmm.1228.mcz

commits-2
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!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-cmm.1228.mcz

marcel.taeumel
+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 [hidden email] <[hidden email]>:

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!




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-cmm.1228.mcz

K K Subbu
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<Class>'?

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 [hidden email]
>> <[hidden email]>:
>>
>> 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!
>>
>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-cmm.1228.mcz

marcel.taeumel
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:

Best,
Marcel 

Am 08.05.2019 18:10:52 schrieb K K Subbu <[hidden email]>:

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 [hidden email]
>> :
>>
>> 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!
>>
>>
>
>



Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-cmm.1228.mcz

Jakob Reschke
Moreover, nil isNill (typo) would answer false instead of signalling an error.

Marcel Taeumel <[hidden email]> schrieb am Do., 9. Mai 2019, 08:38:
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:

Best,
Marcel 

Am 08.05.2019 18:10:52 schrieb K K Subbu <[hidden email]>:

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 [hidden email]
>> :
>>
>> 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!
>>
>>
>
>




Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-cmm.1228.mcz

Stéphane Rollandin
In reply to this post by marcel.taeumel
> 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.

+1

Stef


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-cmm.1228.mcz

K K Subbu
In reply to this post by marcel.taeumel
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 <[hidden email]>:
>>
>> 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 [hidden email]
>> >> :
>> >>
>> >> 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!
>> >>
>> >>
>> >
>> >
>>


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Kernel-cmm.1228.mcz

Eliot Miranda-2


On Thu, May 9, 2019 at 10:39 AM K K Subbu <[hidden email]> wrote:
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.

It can, but it's tricky and difficult to understand and know about and it adds unnecessary complication.  Explicit isFoo methods are much simpler, are readable, and work.  Please, let's not go with the DNU hack.
 

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 <[hidden email]>:
>>
>> 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 [hidden email]
>> >> :
>> >>
>> >> 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!
>> >>
>> >>
>> >
>> >
>>




--
_,,,^..^,,,_
best, Eliot