One thing spending almost my entire life around computers has taught me, is that rarely is anything impossible, so much as it may just be a pain in the ass to get done. For R&R, my interest is in exploring whether or not a wrapper around scripting languages can really work without heavy introspection or SWIG style code generation.
Principally, embedding a scripting language amounts to initializing it, feeding it with code, and stitching together an interface between it and the desired parts of your C/C++ code. In my experience most time is spent on writing code to bridge C with the script language. It's kind of like an adaptor for calling conventions, but in C rather than native code.
The question that interests me, is whether or not C++'s standard issue functors and binders, are good enough that it could be done without having to to cuddling up to much to a specific scripting engines embedding API, for each one being embedded. In most dynamic languages the manipulations needed are pretty trivial, but C++ is rather, more traditional. Because of that curiosity, I've had an idea on my mind for ages, which I dub "Cassius". The idea is, to have an interface that knows how to embed several scripting languages, and use that to interface with the scripting languages, in a way more agnostic to which scripting language you're using.
I thought of the name as a reference both to the Roman name and to Cassius Clay, better known as Muhammad Ali—because after adding support for a embedding a few scripting languages, it might very well knock me out ^_^. The part that I'm not sure, is whether or not, it is technically possible to do it in straight C++, or if the APIs would require more than is possible without using something like SWIG.
Sometimes for a change, it's fun to ride an idea to the end of a tunnel without trying to speculate what's waiting there.
No comments:
Post a Comment