Archive for May, 2007

Is C really a good language for runtime frameworks?

Saturday, May 5th, 2007

Most C-like object-oriented languages (C++, ObjC) have a runtime library. But is writing that library in C such a good idea? It has been two years since Atheme.org set out to create a framework for it’s projects to use, and only recently have we made any breakthroughs on that. Our first attempt was Claro, but this has mostly not made it due to strange licensing arrangements (MPL), which is incompatible with our licensing philosophy.

Our second attempt contains several frameworks for various tasks. This includes Mowgli, which is our base framework. Mowgli can be considered very similar to both Boost in C++ and the System namespace in .NET. At the core of Mowgli, is mowgli.object, which is probably the coolest part of our framework. Mowgli’s object framework is very advanced; it allows for private destructors, hidden visibility, metadata, messaging and a lot more. In addition, mowgli objects can easily be reflected into other systems and paradigms, like D-Bus (we intend infact, to provide a library which does this).

However, is C such a great language for this? The fact that we’re using C means that our types are very long, e.g. mowgli_object_class_t, and so on. For a base library, I think C is probably fine, but I don’t know how usable Mowgli will be alone for writing OO apps using our framework. Perhaps we should also design a language to be used with our frameworks… if that is the case then I’m sure we’ll do OK with that.

Anyway, why not write an object framework in something like Erlang? I guess that isn’t challenging enough.