Extending classes

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

Extending classes

Joachim Jaeckel
Hello again.

I was trying to test the class-extending in smalltalk, therefore I
created a small file with the following content:

Object subclass: MyTest [

         foo [
         ]

         bar [
         ]
]

MyTest class extend [

         additionalFoo [
         ]

         additionalBar [
         ]
]

but if I afterwards do a:

MyTest inspect

Only both initial methods (foo and bar) are shown in the
method-dictionary. Do I have an error in the class-extension?
(I think, the new methods should be shown in the method-dictionary,
shouldn't they?)

Thanks in advance,
Joachim.


_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Extending classes

Joachim Jaeckel
Sorry for the uneccessary question!

I should delete the word 'class' in the extension!

only MyTest extend [

and everything worked fine.



Joachim Jaeckel schrieb:

> Hello again.
>
> I was trying to test the class-extending in smalltalk, therefore I
> created a small file with the following content:
>
> Object subclass: MyTest [
>
>         foo [
>         ]
>
>         bar [
>         ]
> ]
>
> MyTest class extend [
>
>         additionalFoo [
>         ]
>
>         additionalBar [
>         ]
> ]
>
> but if I afterwards do a:
>
> MyTest inspect
>
> Only both initial methods (foo and bar) are shown in the
> method-dictionary. Do I have an error in the class-extension?
> (I think, the new methods should be shown in the method-dictionary,
> shouldn't they?)
>
> Thanks in advance,
> Joachim.
>
>
> _______________________________________________
> help-smalltalk mailing list
> [hidden email]
> http://lists.gnu.org/mailman/listinfo/help-smalltalk
>
>



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk
Reply | Threaded
Open this post in threaded view
|

Re: Extending classes

Paolo Bonzini-2
Joachim Jaeckel wrote:
> Sorry for the uneccessary question!
>
> I should delete the word 'class' in the extension!
>
> only MyTest extend [

Yes, "MyTest class extend" defines class methods like #new, which appear
in the metaclass's method dictionary ("MyTest class methodDictionary").

Paolo



_______________________________________________
help-smalltalk mailing list
[hidden email]
http://lists.gnu.org/mailman/listinfo/help-smalltalk