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

Eliot Miranda eliot.miranda at gmail.com
Fri May 10 17:40:18 UTC 2019


On Thu, May 9, 2019 at 10:39 AM K K Subbu <kksubbu.ml at gmail.com> 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 <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!
> >> >>
> >> >>
> >> >
> >> >
> >>
>
>
>

-- 
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20190510/3f19e9cc/attachment.html>


More information about the Squeak-dev mailing list