In all projects I've done through the years I never came across a requirement like this, though it seems so easy on paper: write a plugin for many well-known CMS's.
Obviously, each plugin-system (or extension system) is different and this requires specific bridging code through an adapter pattern. But the core should be written once. I don't expect WordPress users to use a PHP-Java bridge, and I don't expect DotNetNuke users to use a .NET-Native bridge (though that's easier conceived).
The way I see it, the core should be compilable in three main domains that cover most CMS systems:
C# and Java translate pretty well to and from each other, but C and C# is much harder. Ultimately, it would be nice to possibly add other targets, so as not to force a WordPress or WikiMedia user to install an extension prior to using a plugin.
I'm sure this has come up with other too. What's a common way of tackling such problems? Should I define a DSL first and use DMS or similar to transform? Other options?
Static typed languages also have powerful metaprogramming techniques, for example the C++ template metaprogramming...
Meta's primary supported server-side languages are Hack, C++, Rust, and Python. For performance-sensitive back-end services, we encourage C++ and Rust. Rust is a new addition to this list.
It is possible to combine different languages in one project, you just write two different programmes and let them communicate with each other. And in some cases it even makes sense. Say your project is written in Java or Python for the most part but you have a part that requires a little more computing power.
Cross language support is the ability provided by the common language runtime (CLR) and the common language specification (CLS), of the . NET Framework, for interaction with code written in a different programming language.
Haxe is a sort of meta-language that compiles for different platforms:
Since there's no one language that compiles directly to all of your targets, don't overlook the lowest common denominator. You could build your plug-in using C and then wrap the result for each platform (PInvoke, JNI, PHP extension). If you don't relish the idea of writing a complex plug-in in C, consider doing the heavy lifting using a small, easy-to-use, and embeddable scripting language. Lua seems reasonable. Your final result would be a C skeleton that simply delegates requests and responses to and from the host and scripts.
Program Transformation is related, though the effort to build an effective transformation is significant. In theory, you could transform from the source to source and use the platform-specific compiler. Take a look at TXL and Stratego / XT to get an idea of what's involved.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With