Lobster, a game programming language
strlen.com
strlen.com
On an unrelated note, Lobster seems quite interesting. Will spend sometime on it this weekend.
But, generous nonetheless. Bravo.
I've been a fan ever since I was programming AmigaE, and it was the first and only development tool I've spent money on.
I loved the highlevel-ness of the call to:
camera_FPS_view("w", "a", "s", "d", 10, 4);This language is even more awesome than I thought :)
Couple of things I imagine might bother me:
* Lack of upwards funargs. The reason stated is performance. I realise that it's complicated to implement, but it might be possible to start out with cheap blocks and promote them later to full closures if necessary.
* Reference cycles as an error. It's pretty easy to create these in legit circumstances. Maybe something like Python's auxiliary GC could be useful here.
well, not exactly. You could do: >> var v = new xyz{x:1, y:0, z:0};
I was trying to have a vector of behaviors for my sprites, which would hold arbitrary functions to call when updating the sprite. I don't need to capture any variables, so I don't actually need a closure. But the scope in which the anonymous function was initially created is long gone, so that's probably the issue.
I'll see if co-routines can solve this for me ...
Using high-level function constructs for main language flow control features seems to be in vogue. Rust does it too. I liked it when I learned Scheme and have been wanting it to be more main stream since then. That's probably why I like Ruby, since Ruby's blocks are close for many uses.
I'll play with this more when I get home tonight.
I find that one can do object-oriented things, but constructors are a bit of a catch.
struct A : [a, defaulted]
struct B : A [b]
//You can do it this way,
//but each subclass has to init every field (brittle)
function MakeA(a): [a, 99] : A
function MakeB(a,b): [a, 99, b] : B
//Or use the super constructor syntax
//but this uses a copy and is less efficient
function MakeA(a): [a, 99] : A
function MakeB(a,b): [super MakeA(a), b] : B
//Or something in between
function InitA(me::A, theA): a = theA; defaulted = 99; me
function MakeA(a): new := [0,0]; new.InitA(a)
function InitB(me::B, theA, theB): me.InitA(theA); b = theB; me
function MakeB(a,b): new := [0,0,0]; new.InitB(a,b)
I'll keep playing with it and see what else I discover. I haven't gotten far enough to use coroutines, multi-method, or to make my own control structures yet.