here - Stefan-Marr.de
here - Stefan-Marr.de
here - Stefan-Marr.de
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
7. Implementation Approaches<br />
co<strong>de</strong> can be executed in enforced mo<strong>de</strong>. Other blocks will not be transformed<br />
as part of a the unenforced method version.<br />
Switching back to unenforced execution is done based on an attribute, similarly<br />
to the approach discussed for SOM and used by Renggli and Nierstrasz.<br />
However, in Squeak and Pharo, the syntax for method <strong>de</strong>finitions is<br />
slightly different from the SOM syntax used <strong>here</strong>. T<strong>here</strong>fore, instead of using<br />
an attribute, the method body of an unenforced method needs to contain<br />
the pragma. Methods marked with this pragma are not transformed,<br />
and thus, do not enforce the semantics of the OMOP. However, to<br />
be able to switch back to enforced execution, blocks that receive the #enter:<br />
message are still transformed correctly.<br />
Handling of Primitives Since the AST-OMOP does not change the VM, it<br />
needs another approach to handle primitives. The approach of Renggli and<br />
Nierstrasz to solve the issue was again chosen. All Squeak/Pharo methods<br />
that rely on primitives are marked with a pragma: . The<br />
AST-OMOP adds the pragma to each of these<br />
methods. The method i<strong>de</strong>ntified by the selector is then used as the enforced<br />
version of the primitive method. This replacement method simply redirects<br />
the execution of the primitive to the corresponding intercession handler in<br />
the domain.<br />
Integration with Smalltalk’s Interactive Environment The image-based <strong>de</strong>velopment<br />
tools of Squeak and Pharo require minor adaptations to accommodate<br />
the AST-OMOP. As a cosmetic change, the class browser does not<br />
show the enforced methods, because they are generated automatically and<br />
do not need to be changed manually. Suppressing them in the browser avoids<br />
problems and clutter in the IDE.<br />
The generation of transformed methods is performed on <strong>de</strong>mand. To avoid<br />
the memory overhead of keeping all methods in two versions, method transformation<br />
is only triggered when an existing method is changed, which had<br />
an enforced version, or when an enforced version could not be found and<br />
#doesNotUn<strong>de</strong>rstand: got triggered.<br />
To capture changes of existing methods, additions, or removals, the system<br />
offers corresponding events on which the AST-OMOP registers the appropriate<br />
handlers to generate transformed methods when necessary.<br />
Problematic for this approach are the semantics of class hierarchies and<br />
method lookup. Thus, it is not sufficient to generate only the missing method,<br />
186