Archive for March, 2010

New compiler option to support monkey patching RSLs

Setting up the monkey patch RSL took a bit of work. First
you needed to create an externs file from a link report. Then you needed to
figure out the inheritance dependencies and remove them from the externs file.
Wouldn’t it be nice to have the compiler to this for you? The compiler knows
what the inheritance dependencies are, right?

It turns out that writing the prototype for the new compiler option wasn’t all that hard. I called the new compiler option “include-inheritance-dependencies-only”.
It only works with compc and the -include-classes option. Normally compc
will include all the dependences of classes linked into a swc. But when the new
option is used only the inheritance dependences will be linked in. So the
command to build the RSL swc for the mx.collections.ListCollectionView monkey
patch becomes:

-include-classes mx.collections.ListCollectionView -include-inheritance-dependencies-only
-source-path . -output lcv2 -directory

The new option is just a prototype. It may never see the
light of day. If you think this option would be useful please leave a comment
to let me know.