2013-08-31

extension modules

19: 21: adda/extension modules:
. Python' C interface has 2 uses:
one face simply models python
(for calling python from c),
whereas the other face is for writing extensions:
calling c from python .
. the primary purpose of adda,
on the other hand, is to avoid C:
all extension modules are written in adda,
and then adda translates that to C,
like what Cython is doing: Python to C .


. adda does this in 2 stages:
you write in high-level adda,
then it converts to low-level,
and then converts that to C;
but for more control,
you can write in low-level stage .
. high-level adda is platform-independent,
ie, it doesn't have special features
for taking advantage of platform-specific resources .
. low-level adda is platform specific,
which isn't portable,
but is efficiently a direct translation,
and still looks like adda for readability .
. low-level adda is a shallow binding of
the platform's preferred language;
eg, on mac, that would be Cocoa/obj'c,
and on Google's App Engine, it is Python .
. low-level adda provides only a syntax change,
it doesn't try to impose safety rules .
. for each platform,
high-level translates from adda into
the platform's low-level adda,
in a way that ensures safety and stability .
. if you still need access to C
then that's considered a deficiency in
the low-level adda compiler for C:
there must be some adda idiom
that gives you what you want from C .
. the proper way to use C
thus gets documented by the design of
low-level adda for C .