[Cuis-dev] smalltalk newbie - Complex
ken.dickey at whidbey.com
ken.dickey at whidbey.com
Fri Sep 26 18:43:41 PDT 2025
On 2025-09-26 17:23, Jonathan Kelly via Cuis-dev wrote:
> 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?
This is a good exercise to learn about packages.
The typical practice is to create a method category with $* and the name
of the class the methods are related to.
In this case, method category '*Complex' in class Object would have your
method 'isComplex'.
BTW, after you finish, you could use a file list to package browse:
Cuis-Smalltalk/Cuis-Smalltalk-Dev/Packages/Features/Complex.pck.st
or open a Workspace and invoke
Feature require: 'Complex'.
And see how someone else did it.
HTH,
-KenD
More information about the Cuis-dev
mailing list