Add section on Aspect Oriented Programming after discussion on swig-devel

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12105 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-06-08 06:02:56 +00:00
commit 09f14197ac
2 changed files with 22 additions and 2 deletions

View file

@ -336,6 +336,7 @@
<li><a href="Typemaps.html#Typemaps_nn6">Reusing typemaps</a> <li><a href="Typemaps.html#Typemaps_nn6">Reusing typemaps</a>
<li><a href="Typemaps.html#Typemaps_nn7">What can be done with typemaps?</a> <li><a href="Typemaps.html#Typemaps_nn7">What can be done with typemaps?</a>
<li><a href="Typemaps.html#Typemaps_nn8">What can't be done with typemaps?</a> <li><a href="Typemaps.html#Typemaps_nn8">What can't be done with typemaps?</a>
<li><a href="Typemaps.html#Typemaps_aspects">Similarities to Aspect Oriented Programming</a>
<li><a href="Typemaps.html#Typemaps_nn9">The rest of this chapter</a> <li><a href="Typemaps.html#Typemaps_nn9">The rest of this chapter</a>
</ul> </ul>
<li><a href="Typemaps.html#Typemaps_nn10">Typemap specifications</a> <li><a href="Typemaps.html#Typemaps_nn10">Typemap specifications</a>

View file

@ -18,6 +18,7 @@
<li><a href="#Typemaps_nn6">Reusing typemaps</a> <li><a href="#Typemaps_nn6">Reusing typemaps</a>
<li><a href="#Typemaps_nn7">What can be done with typemaps?</a> <li><a href="#Typemaps_nn7">What can be done with typemaps?</a>
<li><a href="#Typemaps_nn8">What can't be done with typemaps?</a> <li><a href="#Typemaps_nn8">What can't be done with typemaps?</a>
<li><a href="#Typemaps_aspects">Similarities to Aspect Oriented Programming</a>
<li><a href="#Typemaps_nn9">The rest of this chapter</a> <li><a href="#Typemaps_nn9">The rest of this chapter</a>
</ul> </ul>
<li><a href="#Typemaps_nn10">Typemap specifications</a> <li><a href="#Typemaps_nn10">Typemap specifications</a>
@ -115,7 +116,7 @@ chapter with only a vague idea of what SWIG already does by default.
<p> <p>
One of the most important problems in wrapper code generation is the One of the most important problems in wrapper code generation is the
conversion of datatypes between programming languages. Specifically, conversion or marshalling of datatypes between programming languages. Specifically,
for every C/C++ declaration, SWIG must somehow generate wrapper code for every C/C++ declaration, SWIG must somehow generate wrapper code
that allows values to be passed back and forth between languages. that allows values to be passed back and forth between languages.
Since every programming language represents data differently, this is Since every programming language represents data differently, this is
@ -637,7 +638,25 @@ void wrap_foo(char *s, int x) {
</pre> </pre>
</div> </div>
<H3><a name="Typemaps_nn9"></a>10.1.7 The rest of this chapter</H3> <H3><a name="Typemaps_aspects"></a>10.1.7 Similarities to Aspect Oriented Programming</H3>
<p>
SWIG has parallels to <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming">Aspect Oriented Software Development (AOP)</a>.
The <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming#Terminology">AOP terminology</a> with respect to SWIG typemaps can be viewed as follows:
</p>
<ul>
<li> <b>Cross-cutting concerns</b>: The cross-cutting concerns are the modularization of the functionality that the typemaps implement, which is primarily marshalling of types from/to the target language and C/C++.
<li> <b>Advice</b>: The typemap body contains code which is executed whenever the marshalling is required.
<li> <b>Pointcut</b>: The pointcuts are the positions in the wrapper code that the typemap code is generated into.
<li> <b>Aspect</b>: Aspects are the combination of the pointcut and the advice, hence each typemap is an aspect.
</ul>
<p>
SWIG can also be viewed as has having a second set of aspects based around <a href="Customization.html">%feature</a>.
Features such as <tt>%exception</tt> are also cross-cutting concerns as they encapsulate code that can be used to add logging or exception handling to any function.
</p>
<H3><a name="Typemaps_nn9"></a>10.1.8 The rest of this chapter</H3>
<p> <p>