On Thu, Aug 5, 2010 at 1:27 AM, Robert Bradshaw
<[email protected]> wrote:
> +1 The transform could go through and replace any nodes that need
> special casing with special dot_net versions (that only need to know
> how to generate their code). This would keep things nice and modular.
> (The real question is how much code could be shared between the
> CPython bindings and the IronPython ones--the raw C code generation
> would probably be virtually identical.)

I do like this idea.

My tentative plan for merging the existing backend and the C++/CLI
backend back together is to move most of the C code fragments from
Nodes.py/ExprNodes.py into more methods on Code.py's CCodeWriter.
Then I would split the generic parts of CCodeWriter into a new base
class BaseCodeWriter, and add a new subclass CPPCLICodeWriter.  Then
(hopefully) a single conditional in ModuleNode.generate_c_code, where
it creates the rootwriter object, could handle most of the differences
between the backends.  For nodes where the code generation difference
is too large to be reasonably hidden in Code.py, your transform sounds
like a reasonable way to avoid "if dotnet:".

> On this note, it would be cool if, eventually, Jython could be
> supported through similar mechanisms.

That would be very cool.  (I don't know anything about Jython
internals or the JVM foreign function interface, so I don't know how
hard it would be.)

> - Robert

Carl
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to