[Seaside] [ANN] IvapParser (on SqueakMap)

Stephen Pair seaside@lists.squeakfoundation.org
Fri, 6 Dec 2002 09:07:26 -0500


>From the Docs:
-------
Instructions for using the "IVAP" Parser 
by Stephen Pair <spair@acm.org>

"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:.
-------

I've seen this functionality needed in several applications including
Kats and Seaside.  I originally wrote this for Kats, but thought it was
useful enough to stand on its own.  I'm hoping that Avi might consider
adopting this in Seaside so that we can move forward with a common
implementation of this functionality.

- Stephen