Introduction
MiniD is a dynamically-typed scripting language in the vein of Lua, ECMAScript (JavaScript), and Squirrel. Many languages have had varying levels of influence on MiniD:
- Lua, for the underlying execution and memory model, the native API design, and being a never-ending source of inspiration;
- Squirrel, for its class-based object orientation, exceptions, arrays, integers, and weak reference objects;
- D, for its clear syntax, wonderful array handling (concatenation and slicing in particular), scope action statements, modules, metamethod naming scheme, and nice mix of high-level concepts and fast, low-level mechanisms;
- Io, for its prototype-based object model (from which MiniD's class model adopts many features);
- Python, for comprehensions, decorators, and a simple but flexible standard library;
- Haskell and Bla, for shorter syntax for function declarations, lambdas, and calls.
Some D users have tried MiniD and were surprised when many D-isms did not carry over, such as "array.length", or the ability to use assignments as expressions. The name probably has something to do with their confusion. MiniD was named in its infancy when it really was supposed to be an interpretable subset of D, but it has changed so drastically since then that the name could probably not be further from the truth.
However, this doesn't mean MiniD doesn't share traits with D. Rather than mindlessly porting syntax and semantics from D, MiniD instead follows a design approach that is similar to D's. Rather than being built around a one-trick concept like objects or functions, or trying to be completely conceptually orthogonal, MiniD has aggregated useful features from other languages. Also much like D, it provides high-level features while maintaining the ability to write performant code when necessary. Keeping a mindful eye on the performance aspects of every feature that has made it into the language shows: the reference implementation is nearly as fast as Lua, and it's continually getting closer. It already beats most other scripting languages without issue, and it does this while remaining expressive and terse, much like Lua.
Why MiniD?
A question that I've been asked is "why does MiniD exist? Why do we need another scripting language, when there are already so many to choose from?"
Let me first answer this question from a practical standpoint. I am a D programmer. Most other scripting language implementations are written in C or C++, making using their APIs from D tedious and awkward. There are also several irritating issues concerning how their implementations interact with D's garbage collector and exception handling. It'd be nice to have a native implementation of a scripting language for D, one which understood and took into account these and other issues. Reimplementing an existing scripting language in D is an option, but there are problems with it. Most modern scripting languages are large, complex libraries. Besides taking a long time to complete, reimplementations often have subtle differences in behavior from the original that code may depend upon to function properly. Performance characteristics may also be difficult to reproduce. And when the reference implementation gets updated, the reimplementation must also be updated separately; nothing comes for free. It seems like a lot of work to simply reproduce something that already exists and which most people will take for granted.
But there's another possible standpoint from which people have asked this question: "why does MiniD exist? Why even bother creating it when the other scripting languages work just fine?" I'm sorry, but I just can't take this view seriously. If the status quo were good enough, change would not occur. But change does occur, which implies that the status quo isn't good enough. Twenty years ago, how many of the numerous, popular programming languages that exist today were around? Why did their inventors feel the need to invent new languages?
I didn't come up with MiniD to make a name for myself or to make money. I came up with it because I wanted to learn how to implement a language. I did it for fun. I'm just drawing lines in the sand. If MiniD never becomes successful, oh well. There's a very small number of languages that ever do. Invention is a bit like a genetic algorithm looking for a global optimum. Ideas are recombined, evolved, mutated, and selected according to their fitness, resulting in a slow - but inexorable - progression towards perfection. If no one invents, progress halts. Maybe MiniD won't be fit enough to survive, but I'll have at least learned something from making it, and if it inspires someone else to create, that's progress.
So perhaps a much more pertinent question to ask is: "why should I choose MiniD over another language?"
From a practical standpoint, I can tell you that very few other existing scripting language implementations will provide you with the integration with D that MiniD's reference implementation does. MiniD is also consistently one of the fastest scripting language implementations around, approaching the performance of Lua. There are a few other scripting language projects in D, including FlowerScript, Monster, and DMDScript, and you're certainly welcome to use them if they fit your purposes. DMDScript requires that you pay a USD $1000 licensing fee for use in commercial applications, whereas MiniD is free for any use. Monster is aimed at games and is currently much less mature, whereas MiniD is general-purpose and is fully-implemented. FlowerScript is not actively maintained and contains some.. interesting licensing clauses, whereas MiniD has been maintained almost constantly since its creation, and has a simple, clear license.
From a more aesthetic standpoint, I can't tell you anything, because whether or not you like MiniD is up to you. I enjoy its terse syntax, its efficient mechanisms, and its small but orthogonal set of core features; that's just my opinion. People can argue about syntax and semantics all day. If you don't like MiniD, don't use it. But please let me know what you don't like about it and I'll either attempt to provide a justification for why it's that way or take your suggestion into consideration.
Okay, I think I'll get down from the soapbox now.
