From: Haoyu B. <div...@gm...> - 2008-03-26 07:06:16
|
Olly Betts wrote: > Haoyu Bai <div...@gm...> writes: > >> In my opinion, like Python 3.0 is a fork and refactoring of 2.X, our >> Python 3 backend also should be a fork of the 2.X backend? Things like >> classic class and apply() removed from Python 3, so corresponding >> code also can be removed from our backend, to make it clean and easy to >> maintain. >> > > My feeling is that splitting Python support over two backends is probably > a mistake. I speak partly from the experience of maintaining PHP4 and > PHP5 in a common backend, and they're rather difference beasts (at least > with the different approaches SWIG takes to support classes in each). > > Sure you can clean up the backend code by dropping all the cruft, but that > will make the two backends a lot more different, so cross-porting fixes > will be significantly more complicated. As it is we sometimes struggle to > apply user-submitted patches promptly for backends without an active > maintainer - if we have to rework them to apply to a second branch of the > code, that's going to be a lot more of a problem. > > I think a better way to keep the code manageable would be to drop support > for older versions from the existing backend, then add support for Python 3 > to that. > > For example, the -modern option requires at least Python 2.2. We should > just make the minimum supported Python version 2.2 (at least - personally > I wouldn't have a problem with requiring at least 2.3 if that helps with > cleaning out support for older versions) and drop support for -nomodern. > Keep "-modern" for compatibility with existing makefiles, etc but make it > a dummy option. Similarly, classic classes are only a requirement to > support Python < 2.2 (unless there's some other reason to use them that > I'm unaware of). > Thanks your advice. I agree your opinion. Then we should try to keep Python 2&3 backends in one module. I have looked into php4.cxx, then thinking using OO pattern, let PHP4 and PHP5 both inherit from a PHP class may solve this. But SWIG Engineering Manual says: Advanced C++ features like namespaces, templates, and overloading should not be used.. So... I wonder why? Best regards, Haoyu Bai |