[Cuis-dev] smalltalk newbie - Complex

Jonathan Kelly jonkelly at fastmail.fm
Mon Sep 29 14:23:27 PDT 2025


On 30/9/25 00:12, Juan Vuletich wrote:
>
> Hi Jon,
>
> Yes, you're right. If Object needs to be aware of everything it is 
> not, then it needs to be aware of everything that could possibly 
> exist. Of course, that doesn't scale. #is: means 'if I don't even have 
> a clue what you're asking for, then I'm not one of those'! In 
> practical terms it means to avoid the need of everyone adding stuff to 
> Object.
>
I had a look at Object>>#is: and was thinking, how does that help?? A 
little later, looking at isFloatOrComplex - which was puzzling me as 
Kernel doesn't have Complex(?) - something clicked and I went "Oh. 
Nice!". Going back now to get rid of my Object>>isComplex.

re isFloatOrComplex ... I assume that means that Complex was, at some 
point, part of the Kernel?

Jonathan

> Cheers,
>
> On 28/09/2025 9:11 AM, Jon Raiford via Cuis-dev wrote:
>> I didn't notice anyone else pointing this out... Have a look at how 
>> many "is" methods are defined on Object in Cuis. Although it is a 
>> very common pattern in Smalltalk, in Cuis this was changed slightly. 
>> Yes, there are some common is methods like isString (and isComplex), 
>> but there is also the #is: method. The idea is to only implement #is: 
>> on your classes that should answer true. Have a look at implementors 
>> and senders to understand how it's implemented and used. I believe 
>> the purpose of this is to help prevent packages from adding methods 
>> to Object unnecessarily.
>>
>> Jon
>>
>> *From: *Cuis-dev <cuis-dev-bounces at lists.cuis.st> on behalf of 
>> Jonathan Kelly via Cuis-dev <cuis-dev at lists.cuis.st>
>> *Date: *Friday, September 26, 2025 at 8:31 PM
>> *To: *cuis-dev at lists.cuis.st <cuis-dev at lists.cuis.st>
>> *Cc: *Jonathan Kelly <jonkelly at fastmail.fm>
>> *Subject: *[Cuis-dev] smalltalk newbie - Complex
>>
>> Hi,
>>
>> I'm playing with Cuis smalltalk, and building a Complex class, so far so
>> good. But I want to add an  "isComplex" method on Object, and
>> an  "asComplex" method on Number, but I can't find a way to tell Cuis
>> that the new methods belongs to the Complex package.How do I make all my
>> changes belong to the Specific package they're related to?
>>
>> Thanks
>>
>> Jon
>>
>> --
>> Cuis-dev mailing list
>> Cuis-dev at lists.cuis.st
>> https://lists.cuis.st/mailman/listinfo/cuis-dev
>>
> -- 
> Juan Vuletich
> www.cuis.st
> github.com/jvuletich
> researchgate.net/profile/Juan-Vuletich
> independent.academia.edu/JuanVuletich
> patents.justia.com/inventor/juan-manuel-vuletich

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20250930/511ddb6b/attachment.htm>


More information about the Cuis-dev mailing list