On Thu, Aug 5, 2010 at 12:08 AM, Dag Sverre Seljebotn <[email protected]> wrote: > On 08/05/2010 06:01 AM, Carl Witty wrote: >> I'm working with Enthought on a branch of Cython to target .NET for >> IronPython. I'm maintaining a repository at >> http://bitbucket.org/cwitty/cython-for-ironpython (I just started >> writing code, so there's not much interesting there yet). >> > Great, I think this is fantastic news.
I'm excited about this too. >> I'm hopeful that eventually this code will be merged back into Cython; >> I don't want to fork Cython. >> > I hope this stays in Cython as well. >> I'm starting by essentially duplicating all of the generate_* methods >> into generate_dotnet_* methods, and modifying the duplicated methods >> to generate C++/CLI code. My hope is that once I have a working >> > Ah, this is very interesting -- when I've spoken with Enthought on the > matter we've largely ignored C++ for this and were talking about a C# > backend. >> compiler, I can refactor to merge most of the methods back together >> (eliminating the duplicate code) while still not being very intrusive >> to the original codebase. >> > > Have you considered writing a transform instead of adding more methods > to the nodes? E.g. something like Cython/CodeWriter.py for the .NET > backend? That would be even less intrusive...ideally, one would just > configure the pipeline differently depending on what the backend is. +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 once suggested that the CPython generation was also moved into a > seperate generator class like this as well; of course, that's a lot of > unnecessary work) > > I'm just not too sure about having "if dotnet:" all over the place > (eventually). Of course, you should just do whatever gives results > quickest at this point (and I very much trust your judgement), I'm just > making sure the option is mentioned. On this note, it would be cool if, eventually, Jython could be supported through similar mechanisms. - Robert _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
