Login  Register

Re: Adding method to class

Posted by Baptiste Quide on Jul 17, 2014; 2:07pm
URL: https://forum.world.st/Adding-method-to-class-tp4768282p4768287.html

I think you have to add a "RGMethodDefinition" or a "CompiledMethod".
Obviously in a class methodDict the values are CompiledMethod.

Regards,


De: "Sebastian Tleye" <[hidden email]>
À: "Any question about pharo is welcome" <[hidden email]>
Envoyé: Jeudi 17 Juillet 2014 16:03:52
Objet: Re: [Pharo-users] Adding method to class

I don't know what RBMethod is, but you can do 

aClass compile: source.

For example: 

Array compile: 'newMethod ^ 1'

I don't know if it answers your question.

Regards




2014-07-17 15:57 GMT+02:00 Mark Rizun <[hidden email]>:
P.S. obviously, my method is added to newMethods var, but it is not disblayed in my class.


2014-07-17 15:53 GMT+02:00 Mark Rizun <[hidden email]>:

Hi guys!

How can I add method (I have /RBMethod/) to a class in code?
I'm asking because existing method /addMethod:/ in /RBAbstractClass/ isn't
working.
Here is a piece of my code:

/method:= RBMethod for: class source: ('^ ', newName asString) selector:
newName asSymbol.
        class addMethod: getter./

Best
Mark



--
View this message in context: http://forum.world.st/Adding-method-to-class-tp4768282.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.