I have chosen a scripting language for my game, and after having brief uninformed looks at
MiniD,
PyD and
DLisp - I choose the most obscure, least maintained of the bunch - DLisp.
What is it?
It's a minimal Lisp implementation in D, taking full use of the builtin garbage collector of D. Sadly the author
kind of faded away, I just hope he is healthy and alive. So for now I
forked the codebase and
will try to maintain and extend it. After some fiddling around unittests run again - but the test suite is fairly limited.
Since I want to use it as a scripting language for an object oriented game written in D, I decided to add builtin object orientation since I hope this will ease the exposition of game objects.
Edit: Why DLisp over the others?So why did I choose the least maintained and complete scripting language available? Basically two reasons - First I started this Project to
learn new stuff - and Python I use regularly, the languages inspired by D or simply Lua don't offer something new. So choosing a Lisp version and a tiny one offers the opportunity to learn something completely new. Second I needed a
data description language - I know that lua and python can be used like that (though using Python using as a DSL feels like an abuse.) - but the others didn't struck me as such.
A third reason I might add, is that having
intimate knowledge over the script languages
implementation enables me to fix bugs and odd behaviour right away.
Status
DLisp is fairly usable already, although the OOP code and syntax is still under heavy development.
Syntax snippets
;; Level Data
;; Mar. 2008
(setf *level*
(make-instance level-class "My Test Level"))
(defun place-tile (x y name)
"place a tile at x,y created from tile-prototype name"
(call-method *level* place-tile
(x y (make-instance (get-attr *dataset* name)))))
(map place-tile
((5 5 "red")
(5 5 "red")))
;; Method calling syntax?
;; Explicit - Works but ugly syntax
(call-method object 'method-name args)
;; Implicit
;; Problem is that we need 1 lookahead
;; and one cannot override macros.
(method-name object args)
;; Special syntax
;; Looks a bit unlispy - and overriding functions
;; would still need the implicit syntax ...
(object:method-name args)
Binding snippets
class MyClass {
// Some constructors.
this() ...
this(string name) ...
// Some methods
void methodName(int arg1, int arg2) ...
string returnsString() ...
// BINDING CODE
// Generate the core binding
mixin BindClass!("MYCLASS");
// Default constructor is autogenerated
mixin BindConstructor!(string);
// Bind the methods.
mixin BindMethods!(methodName,returnsString);
}