On 29-04-2013, at 1:03 PM, Dvir Faivel sdvirf@t2.technion.ac.il wrote:
Thanks Bob! the example helped a lot.
Tim, i want to change the behavior of some methods (at runtime, based on the user's decision). for example, if a method of class A contains the comment: "hello, this is a comment" than if B inherits from A, this method wouldn't be inherited (an attempt to call this method from an object of type B would cause an exception to be thrown). the reason i'm using a comment is that it doesn't affect the code.
is there a simple way to add a code to a method? for example, to add "this is a comment" to the end of the code?
It sounds to me as if you might be better off using a pragma; not that I'm any sort of expert on how pragmas are usable in current Squeak. We use a variety of pragmas in the VMMaker code to annotate methods for the C code generator; seems to me you are wanting something faintly similar.
Perhaps an even simpler approach might be to add a method in your class B with the same selector and implement it as self shouldNotDoThisException raise
tim -- tim Rowledge; tim@rowledge.org; http://www.rowledge.org/tim Ornerythologists study bad tempered birds