Hi,
Chuck Blake wrote:
> 1) Idempotent inclusion (already described)
> 2) Compile-time constant defaulting/overriding
>
> In client-module: # client knows objects in the B-tree
> DEF M = 128 # are small and wants large branches
> include "Btree.pxi" # to minimize TLB misses/latencies.
>
> In btree.pxi: # but the impl module can provide a
> if not DEFINED M: # reasonable default definition
> DEF M = 10
> int someArray[M]
>
> This general style of thing could also be done even better with
> a smarter include:
> defining_include "Btree.pxi" M=2, X=Y, ...
That's a funny idea. We could extend the "include" syntax into
include("theinc.pxi", **kwargs)
with
include "theinc.pxi"
being a special case allowed for backward compatibility. The keyword arguments
to the include would override any compile time DEFs done in the include.
Although a function might imply that include is not a keyword. Maybe
include "theinc.pxi" DEF A=1, ...
would work better.
I'm not totally clear about the semantic implications, BTW, and I'm not sure
that the feature /itself/ is a good idea. I just think it doesn't look too bad.
> 3) Compile-time function availability testing
>
> "enumerate" is currently available at compile-time, but "sorted"
> and "reversed" are not. "oct" and "hex", but no "bin" (not in
> python either...). Who can anticipate what Python and you guys
> may want to add (or subtract!) from the builtin namespace?
> It's nice to let developers phase in the dependence of their
> code on new Cython versions.
I think this is a non-issue. New Cython versions are trivial to install. That
said, most people who use extensions that were written in Cython will not
install Cython at all, and instead rely on the distributors to package the
readily generated (and tested) C code with the source releases. So, if you
want to use bleading-edge Cython features in your code, you're pretty free to
do so without caring too much about older Cython versions.
Stefan
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev