Aspect oriented programming: Difference between revisions

Line 125:
Several of Julia's graphics frameworks use the idea of a backend for graphics, where the graphics module wraps and extends a lower level graphics framework. The use of one module to wrap another captures most of the ways in which aspect programming seems to be used. As an example, here we add logging to a module. Users of the Adder module can simply import the LogAspectAdder module instead of the Adder module to add logging to the functions of the Adder class.
<lang julia>module Adder
exports add2, add10
 
function add2(x)
Line 133:
 
module LogAspectAdder
exports add2, add10
using Adder
const logio = [stdout]
function log(s, io=logio[1])
println(io, now(), " ", s)
end
 
4,102

edits