From MethodProperties to Pragmas
renggli at gmail.com
Fri Jan 20 11:38:20 UTC 2006
I changed the implementation of the class MethodProperty to match the
one of the pragma-framework found in VisualWorks. MethodProperties in
Squeak only provided a small subset of the functionality available in
VisualWorks and with a completely different interface. I am in favour
-- if they are available and make sense -- not to introduce yet
another concept, but stick to 'standards'.
What I did:
- MethodProperty was renamed to 'Pragma', it provides the same
protocol as the class in VisualWorks, however it is implemented
- The Squeak Parser was changed to deal with all kind of pragmas, such
as <foo>, <foo: nil>, <foo: -1 bar: 'zork'>, etc; MethodProperties
only supported the one argument form <foo: #bar>. Primitives are also
parsed as Pragmas, what has the nice side-effect that one can look for
all senders of #primitive: and #primitve:module:. Unfortunately the
FFI package introduces a very ugly hack to define its external
functions. External functions are parsed the same way as before;
however I feel the need to change that, so that the FFI package does
not need to patch the parser anymore.
- CompiledMethod efficiently stores the pragmas within the literal
frame as implemented by Marcus Denker. The new implementation takes
care not to waste memory: methods without pragmas have the
literal-slot set to nil, methods with pragmas store an array of Pragma
instances. There is no dictionary required.
- The parser of the submitted version does not implement the mechanism
of VisualWorks to force the use to declare the pragmas he is using
with <pragmas: #class> and <pragmas: #instance>. If requested I can
submit an enhanced version that provides this feature.
- The Pragma class implements a complete protocol to efficiently find
pragmas in classes and class-hierarchies.
- All the parts of the implementation are heavily testsed in the class
PragmaTest (25 run, 25 passes, 0 expected failures, 0 failures, 0
errors, 0 unexpected passes).
To load the code you have to file-in the attached change-set, it is a
hand-modified one to make sure everything is done in the right order.
At the end it will recompile the image and all PragmaTests should
pass. I tested it on the latest Squeak3.9a-6715.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 25548 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/v3dot9/attachments/20060120/cc8d7692/Pragma.obj
More information about the V3dot9