Just want to inform you about some particularily intrusive changes on cdef variables (see the latest dagss changes). I'll discuss it thoroughly because it is a nice example of reducing the number of variable assignment cases (more on that in another post). I'd really like to have this change go in, but it is not trivial and I can understand it if you resist it.
1) Bug fix: We generated erronous C code for cdef assignments in class bodies, I now raise a compiler error on this. 2) Basically I turn "cdef int x = 4" into "cdef int x; x = 4". 3) Also I added the "first" attribute to SingleAssignmentNode to generalize the concept of first assignment (which takes care of optimal refcounting). Optimizing first assignments in the more general case is now as simple as running through the tree and setting that attribute (after analysis, prior to generation), though I didn't do this. This kind of clashes with Robert's flow control endaveours, but I feel that the beginnings of flow control is overkill for this specific case, a single pass with a transform should do it... Results: - C code looks exactly like before (I diffed it), except for comments. - The buffer just started working without any extra efforts (and it made it very easy to optimize some refcounting for buffers, though that needed five lines). Of course, this is why I bothered. - No CVarDefNode in the tree after analyse_declarations As for the code: - Removed about 30 lines and added about 40. However I do feel that the transform code is less "copy-and-paste-with-modifications" and that new code is more obvious to beginners (Stefan can pull out his article URL by now :-) I'll follow up with another post to discuss assignments in general. -- Dag Sverre _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
