FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Embedding and extending MiniD

 
Post new topic   Reply to topic     Forum Index -> MiniD
View previous topic :: View next topic  
Author Message
KlausO



Joined: 16 Feb 2006
Posts: 27
Location: Germany

PostPosted: Sun Jun 10, 2007 4:18 pm    Post subject: Embedding and extending MiniD Reply with quote

Hi Jarret,

I'm currently try to integrate a scripting engine into one of my C++ projects. I took a look at several scripting engines (Pawn, GameMonkey Script, Io, Squirrel, Nasal, Lua, ...) and each of them has their pro's and con's.

Since I don't mind about an extensive feature set, I took almost unknown candidates like Nasal into account. Nasal shines when it comes to thread safety but the documentation is horribly dense Wink.

I would have choosen MiniD because I like the language, but it is currently not an option because the target is WinCE/ARM and there is no GDC available for that platform, which is capable to compile the current tango library Sad.

Aside from this there are two other points that influenced my current choice towards Lua:
* easy extensibility
* easy embedding

Conclusions
If my need is a standalone interpreter I would use MiniD.
I think that MiniD could compete with Lua when these two points are addressed in future development.

Ideas

Extensibility
Support a way to add C/C++/D-libraries to the language. To achieve this you had use a common ground (C-interface or abstrakt classes/COM-like interfaces). Most scripting engines define a C-exported function which registers new functionality to the language core when called.

Embedding
Make it easy to integrate MiniD into C/C++/D-applications. This means that it should be possible to compile MiniD as a loadable module which is loaded by the application and invoked by a C-interface. The application should be able to register access points (functions and classes) to MiniD in the same way as extensibility is achieved.

Just my thoughts

KlausO
Back to top
View user's profile Send private message
JarrettBillingsley



Joined: 20 Jun 2006
Posts: 457
Location: Pennsylvania!

PostPosted: Sun Jun 10, 2007 8:32 pm    Post subject: Reply with quote

Both of your points -- extensibility and embedding -- are already fairly easy to do, and will be getting much better in the next few releases with many improvements to the API. In particular, dynamic library loading through DDL (once it's ported to Tango) will allow for loading of native code into the MiniD VM state from external files. This can already e done manually from the host app as well. Furthermore, MiniD modules can be compiled to a binary format using minidc; these can then subsequently be loaded by just importing them from your app or from other MiniD code.

However, the main problem is integration with C/C++. MiniD is designed from the bottom up to be a D scripting language, taking advantage of templates, exceptions, and garbage collection, none of which are compatible with C or C++. In order to offer such a binding, there'd have to be basically a separate implementation of MiniD, probably written in C. It could be done with D, exposing a C interface, but the implementation would have to be changed so drastically that it would have to be maintained as a separate implementation.

That being said, please don't take this as an attack on your choice Smile Lua is a great language (and was a very large inspiration for MiniD), and for your purposes is probably the best choice. Another issue is size -- MDCL, the MiniD command-line interpreter, is 527KB, about 2.5 times the size of the corresponding Lua interpreter. Granted, both of those include the compiler, which is large in Lua and even larger in MiniD, but Lua's still smaller (and faster), being implemented in C and having had 15 years of development put into it. But please keep MiniD in mind for your future (possibly desktop-based) D projects Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> MiniD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group