interrogate2swig.py

[quote]

There are still a few stumbling blocks to overcome before we can even consider wholeheartedly embracing swig. The biggest is the large body of code that is already written using the interrogate-generated interface; we would probably need to find a way to finesse the swig interface into being mostly compatible with the interrogate interface. The first 90% of this is renaming the methods the same way we do, which is trivial; but the rest of it may be trickier (automatic reference count maintenance?).
[/quote

Yes, this is my thought too. I felt a little like when you are climbing one of those convex mountains. You can see the top about 100m away, so you can get there in just a few minutes, but when you get there, you realize that wasnt actually the top.

So, there’s no way I could handle the migration to swig on my own (not without a lot of time anyway; for example I dont even know what Direct does at this point).

I have to say, the more I think about this, if I was going to run a production switch to swig, I’d probably switch to use swig interface files as the published reference. I dont want to say this because it does imply a change to what developers see, but I do believe its the cleanest way.

These files can easily be generated initially (interrogate2swig.py can do this; it has a tree walk which generates a .swg file for each header file, right next to it). However, once they’ve been generated, they should probably be maintained as the reference, in place of the __published: interface.

Then, a migration would run like this:

  • run an initial runtime performance benchmark against interrogate
  • simplify the published classes to not use anything nested, including enums or other classes
  • modify interrogate2swig.py to generate the %rename directives so that the function naming is compatible with interrogate
  • run the interface file generation
  • tweak the interface files (eg add the as_node implementation to public: for LightNode, so that PointLight can be instantiated)
  • check that everything builds ok
  • benchmark runtime performance against interrogate
  • check that everything builds ok again
  • switch build methods

Hugh