| SWIG and Typesystems |
| |
| <h2>SWIG and Typesystems</h2> |
| |
| <p> |
| For the past seven years, a considerable amount of effort has gone |
| into the development of SWIG and its support for various programming |
| languages. Currently, more than a <a href="guilty.html">dozen developers</a> work on the system |
| and there are thousands of users. However, almost all of SWIG's development |
| has been relatively ad-hoc---primarily driven by feature requests from |
| users. As SWIG's original author, coordinating all of this chaos has |
| always been a bit of challenge. In fact, it's been rather difficult to even |
| describe what SWIG "is" and "how it works" without using terms like |
| "magic" and, well, "more magic." Needless to say, this isn't the most |
| academic way to look it ;-). |
| |
| <p> |
| A little over a year ago, I became interested in the relationship |
| between SWIG and work in the area of type systems. In order |
| to support advanced C++ features like namespaces and templates, a |
| significant amount of very difficult development work focused on the |
| SWIG type system. Moreover, this work resulted in a lot of old SWIG |
| features being folded into type system extensions. Because of this |
| work, I have now come to view SWIG as being mostly driven as an |
| extension of the C++ type system rather than an extension of a C++ |
| parser. This difference is subtle, but it is the only way to really |
| understand how SWIG works at a fundamental level. |
| |
| <p> |
| To the best of my knowledge, no one working on automatic C/C++ wrapper |
| generators has really approached the wrapping problem from the |
| standpoint of type systems. Instead, everyone seems to focus on the problem |
| of <em>parsing</em> C++, which, although important, is not enough to |
| really understand what is going on. |
| |
| <p> |
| Starting in the summer of 2003, the NSF will be funding a |
| <a href="http://www.fastlane.nsf.gov/servlet/showaward?award=0237835">research |
| project</a> at the University of Chicago to explore the relationship |
| between type-systems and wrapper generation in more detail. A lot of |
| this work will involve SWIG and the semantics of its underlying type |
| system. Moreover, this work will be exploring some exciting new |
| features such as software contracts and improved mixed-language |
| debugging support. We're also going to try and make connections |
| between SWIG and related work in the area of programming languages. |
| |
| <p> |
| What does this mean for the future of SWIG? Well, my hope is that |
| this work will make the system more capable, more reliable, and more |
| useful than ever. I think everyone will be pleasantly surprised with |
| some of the changes. |
| |
| <p> |
| As always, I'd like to acknowledge everyone who has contributed to SWIG |
| over the years---thank you for your support! |
| |
| <p> |
| Cheers, |
| <p> |
| Dave Beazley <br> |
| March 23, 2003 |