[Pharo-project] Adding method to Character

Tony Fleig tony.fleig at gmail.com
Thu Nov 11 18:44:22 CET 2010


After a little research...

Great! The last time I used Smalltalk there were no packages. What a useful concept class extensions are.

Is the best way to see a package's extensions to just browse the package (i.e. Ctrl-P in the packages pane of the browser)?

TF

On Nov 11, 2010, at 8:56, Stéphane Ducasse <stephane.ducasse at inria.fr> wrote:

> 
> On Nov 11, 2010, at 5:14 PM, Tony Fleig wrote:
> 
>> Hi,
>> 
>> I find myself wanting a Character>>isConsonant method in addition to the existing Character>>isVowel method. It might be defined as
>> 
>>     Character>>isConsonant
>>         ^ self isLetter & self isVowel not
>> 
>> My question is: what is the best way to do this?
>> 
>> Should I simply add the method to Character? If I do, I guess I must remember to merge my Monticello changes into each new version of Character? Is there some way to bundle this change in my package so I don't forget?
> 
> but if you add this method in the character class as a class extension of your package then the addition will be done automatically each time 
> you load it.
> 
>> 
>> I have created a method in my class MyClass>>characterIsConsonant: aCharacter, but it doesn't read well in the code.
>> 
>> I suppose I could add the method dynamically in my class's initialize method... Not sure how to do that exactly.
>> 
>> Is there another way to do this that I haven't thought of?
>> 
>> Thanks,
>> TF
> 
> 




More information about the Pharo-project mailing list