[squeak-dev] using reflections in squeak

Dvir Faivel sdvirf at t2.technion.ac.il
Sun Apr 28 20:55:45 UTC 2013


hi there,
i have a question about squeak object model.

how can i check whether a method contains a certain piece of code?
i.e if the method "isKindOf:" has the code "class inheritsFrom" - return
true, otherwise - return false (in this case, isKindOf indeed has that
code, so i expect to get true).

obviously if i know the class+method, than i can check the code in the
Browser, but how can i perform this check at runtime when the class+methods
are given as an input?

if the class is represented as aClass, the method is represented as
aMethod, and the code to check is: 'check if this code exist',  than i
guess the start would be:

checkClass: aClass andMethod: aMethod
     aClass respondsTo: aMethod
          ifTrue: [ ^ hmmmmm hasCode: 'check if this code exist'  ]
          ifFalse: [ ^ false ]

but what should i actually check in the ifTrue block?
i need to be able to check this by code, and not with the refactoring
browser.

sorry for the (very) long question.
thanks,
dvir.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130428/6e44fb64/attachment.htm


More information about the Squeak-dev mailing list