top | item 45059459

(no title)

Aardappel | 6 months 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.

discuss

order

dr_kiszonka|6 months ago

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.

Aardappel|6 months ago

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"