Hacker News new | ask | show | jobs
by Aardappel 294 days ago
Seen by creator :)

It comes with a tiny minecraft clone in < 100 lines of Lobster.

Agreed it could use more actual game examples. I've written a ton of game prototypes in it, and some could do with open sourcing, just haven't gotten around to it.

2 comments

Hi, very nice language!

I noticed that Lobster, like many other languages, does not use the C style for-loop syntax, `for (int i = 0; i < m; i++): print(i);`. Could you say why that is? I have been writing Python for many years but still miss that C syntax. Initiating `i` right before every loop feels clunky to me.

In Lobster, this is `for(m) i: print(i)` Or simply `for(m): print(_)`

The syntax comes from the observation that even in C-like languages, 99% of the time I want to iterate over the range (0..m-1), so that's what it is optimized for.

I don't enjoy writing the same boilerplate over and over. Moreover, because it is so verbose, it is hard to spot `for (int i = 0; i <= m; i++): print(i);` being a special kind of loop since it looks so similar to the common `<` case. I'd rather that looks entirely different to alert me we're also iterating over the bound.

I am not sure what you mean by "Initiating `i` right before every loop"

Ah hey, nice language! A minecraft clone in <100 lines sounds like a pretty awesome feat, I'll definitely check it out!
https://github.com/aardappel/lobster/blob/master/samples/lob...

It brings the joy back to graphics and game programming.