Jump to content

Aspect oriented programming: Difference between revisions

m
m (→‎{{header|Go}}: Minor changes in wording.)
Line 120:
 
Bemson's [https://github.com/bemson/Flow/wiki/ Flow library] introduces an aspect-like framework for JavaScript.
 
 
=={{header|Julia}}==
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)
return x + 2
end
end
 
module LogAspectAdder
exports add2, add10
using Adder
const logio = [stdout]
function log(s, io=logio[1])
println(io, now(), " " s)
end
 
function add2(x)
log(s)
Adder.add2(x)
end
end
</lang>
 
=={{header|Kotlin}}==
4,105

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.