Aspect oriented programming: Difference between revisions

Content added Content deleted
(Aspect oriented programming in Prolog)
m (→‎{{header|Wren}}: Minor tidy)
 
Line 418: Line 418:
Notice also that a client can still import the ''wrapped'' class via the ''wrapper'' module which enables it to call ''unwrapped'' methods without the need to import the ''wrapped'' module as well. To expand the Julia example a little:
Notice also that a client can still import the ''wrapped'' class via the ''wrapper'' module which enables it to call ''unwrapped'' methods without the need to import the ''wrapped'' module as well. To expand the Julia example a little:


<syntaxhighlight lang="ecmascript">/* adder.wren */
<syntaxhighlight lang="wren">/* adder.wren */


class Adder {
class Adder {
Line 426: Line 426:
}</syntaxhighlight>
}</syntaxhighlight>


<syntaxhighlight lang="ecmascript">/* logAspectAdder.wren */
<syntaxhighlight lang="wren">/* logAspectAdder.wren */


import "/adder" for Adder
import "./adder" for Adder


var Start = System.clock // initialize timer for logging
var Start = System.clock // initialize timer for logging
Line 444: Line 444:
}</syntaxhighlight>
}</syntaxhighlight>


<syntaxhighlight lang="ecmascript">/* adderClient.wren */
<syntaxhighlight lang="wren">/* adderClient.wren */


import "/logAspectAdder" for LogAspectAdder, Adder
import "./logAspectAdder" for LogAspectAdder, Adder


var a = LogAspectAdder.add2(3)
var a = LogAspectAdder.add2(3)