IvapParser

Summary: Instance Variable Acess Protecting Parser
Author: Stephen Pair
Owner: Stephen Pair (svp)
Co-maintainers: <None>
Categories:
Homepage: http://spair.swiki.net/31
PackageInfo name: <Not entered>
RSS feed:

Description:

Instructions for using the "IVAP" Parser
by Stephen Pair

"IVAP" is an acronym for "Instance Variable Acess Protecting"; thus what we have is an instance variable acess protecting parser. The IVAP Parser enables you to selectively compile message sends where instance variable accessing bytecodes would normally appear. This effectively enables you to trap all reads and writes to instance variables without needing to write special code in your class to do so. Additionally, the "inst var refs..." and "inst var defs..." functionality of the system is modified to be aware of such specially compiled methods.

You can choose to enable this special compiling behavior on a class by class basis. Additionally, you can control which methods within a class use the special compiling behavior. To enable a class to trap inst var access, you first need to override #useInstVarAccessorMethods in your class (on the class side) to answer true. Then, you can override one or both of #selectorForInstVarAccess or #selectorForInstVarMutation to answer the specific messages that you want to have sent when an attempt is made to access an instance variable. See those methods for details on the signature of those methods. You do not need to override both methods; thus you can choose to trap only reads or only writes.

That is it! Any methods that you compile in your class will now trap inst var reads and/or writes (it is up to you to actually implement the messages that are sent to access instance variables).

You may also be more selective in which methods will actually trap reads and/or writes by overriding #normallyCompiledMethods and/or #useInstVarAccessorMethodsFor:.

Releases


Back