2.26: adda/aop/higher-order function programming:
. an example of AOP (aspect oriented prog'ing)
is a logger: you want every function to
log what it's doing .
. your job as a programmer is to
go into every new function and apply a recipe
for how to rewrite the function
so as to have it do this logging .
. in AOP, your job is to automate the
programming of that recipe
with something like this:
for each new function defined:
. if this function is recipe's target
(passes some tests like being of a certain type)
then search for some class of expressions,
and use list processing to modify the expression
(this is routinely done in lisp).
. just like you can find an expression with wildcards
(eg, find a function named f, with any params)
you can replace that find with something like
a declare block that includes f .
. this is the same way optimizations can be done;
and it could simplify the way
HLL-to-HLL compilers are designed
(these are compilers that translate one high-level lang
to another high-level lang, eg, adda lang -> C lang ).
Showing posts with label higher-order functions. Show all posts
Showing posts with label higher-order functions. Show all posts
2012-02-29
adda's equivalent to Python decorators
2.26: adda/functions/Python decorators:
. a note of mine that was wondering how to
impl' AOP (aspect oriented prog'ing)
[@] 11.9.16: mis.adds/aop (aspect oriented prog'ing)
had me responding now that
a first-class lisp system would make it easy to
add AOP later .
. the topic of higher-order function
(the class of functions that
input and output other functions)
reminded me that python does decorators;
the syntax is:
@fun1 @fun2 ... def funx(): body .
. an adda-style syntax for that would be:
funx().proc: fun1 fun2 body .
. a note of mine that was wondering how to
impl' AOP (aspect oriented prog'ing)
[@] 11.9.16: mis.adds/aop (aspect oriented prog'ing)
had me responding now that
a first-class lisp system would make it easy to
add AOP later .
. the topic of higher-order function
(the class of functions that
input and output other functions)
reminded me that python does decorators;
the syntax is:
@fun1 @fun2 ... def funx(): body .
. an adda-style syntax for that would be:
funx().proc: fun1 fun2 body .
Subscribe to:
Posts (Atom)