6 ms·
The Lobster Programming Language
- tines 1y agoNice! So it looks like polymorphism is done via C++ template-style ad-hoc polymorphism? Are there any restrictions on it? Also, is there any kind of sophisticated pattern matching? I feel like for me a language without pattern matching is a non-starter these days.
- Aardappel 1y agoYes, its somewhat similar, monomorphic specialization. I am sure it has some limitations, but it is pretty powerful, it can even do things C++ can't, like have a type error in a branch that in the current specialization is never executed doesn't count as a type error :) There's no FPL style pattern matching. It can do a switch case on types (the various subclasses of a base class) but only 1 level, i.e. can't match against type of members. That could still be added, just personally rarely have use for it.
- tines 1y ago> like have a type error in a branch that in the current specialization is never executed doesn't count as a type error I’ve struggled with my feelings on this even to the extent that C++ allows it, because while it is flexible, it can also hide errors in libraries that will only blow up when used in very specific ways.
- Aardappel 1y agoYes, that is a downside, but when you write very generic code being limited in what code you can write because it has to typecheck even for types that it doesn't apply to is one of the more frustrating things of doing this in C++ and other languages.
- xscott 1y agoI had seen Lobster before, but not really looked closely. Seeing it again now, I think I was wrong to dismiss it. Just at the syntactic level with semantics described in the link, it looks like it really might be "Python done right". The link mentions lots of features, but the following bits caught my eye. The let/var declarations for constants/variables is much better than implicit declaration, which silently hides typos and necessitates ugly global/nonlocal declarations. (Mojo offers this improvement too.) I don't know for sure, but it seems like it's embraced block arguments comparable to how Ruby or SmallTalk does it. So you can add your own control flow, container visitors, etc. I think of this as another syntax for passing a lambda function as an argument, and I'm curious if Lobster's optimizer flattens it to a basic block when possible. I think I'll try to learn more about it. I wonder if the name is a nod to Accelerando.
- Aardappel 1y agoYup, it generally inlines lambdas passed to custom control flow functions, so it ends up pretty similar to hand-written. The name does not refer to anything in particular :)
- benrutter 1y agoThis is a really nice looking language. Feedback in case the creator sees but it wasn't obvious to me at first that it was targeting game development. The first mention is in features: > Features have been picked for their suitability in a game programming language Would be fun to see some basic games like tetris, pong etc in Lobster in case anyone has an example floating round?
- Aardappel 1y agoSeen 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.
- benrutter 1y agoAh hey, nice language! A minecraft clone in <100 lines sounds like a pretty awesome feat, I'll definitely check it out!
- klaussilveira 1y agohttps://github.com/aardappel/lobster/blob/master/samples/lobstercraft.lobster https://github.com/aardappel/lobster/blob/master/samples/lob... It brings the joy back to graphics and game programming.
- dr_kiszonka 1y agoHi, 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 1y agoIn 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"
- nobleach 1y agoObviously some will find this a silly opinion but the one thing that turned me off the most about the Nim programming language was its use of significant whitespace. The same is true with F# (and of course Python). Having had apps with YAML for config, and having had nightmares trying to copy/paste config directives from various sources, I just find whitespace to be unwieldy. Now that's a strong opinion, (weakly held - as a language can't be judged based on this design decision). But it does sour my interest a bit.
- scotty79 1y agoI'm automatically going to be interested in any language with significant white space because there are very few mainstream ones and I hate the visual clutter that block delimiters create. Pretty much there's just Python. Scala 3 can happily do both. I think we'd be better off if text editors just had option of representing braces and such as consistent indentation. Block delimiting tokens should optionally have semantics of non directly printable characters like new line or tab.
- pklausler 1y agoYou'd love Haskell, which uses curly braces for many constructs, but also has rules by which they are implied by indentation -- so in practice you only ever see them on records.
- scotty79 1y agoI'm not sure. The semantics is too wild to care about indentation or delimiters. I love Scala 3 though. Very rich and flexible language.
- recursivecaveat 1y agoI love python syntax overall, absolutely despise Haskell. Wastes my time constantly and gives me incomprehensible compiler errors when you screw it up. Expression oriented languages are really poorly suited for whitespace imo, unless they're hyper-regular like s-expressions: I could imagine a decent whitespace-based version of those.
- rurban 1y agoOne of the few light excellent C++ projects
- nathan_compton 1y agoOne thing I hate about Generative AI is that it has flipped the value prop of making your language similar to an existing popular language. This helps new programmers but it really messes with generative AI. I can feel the era of fun new programming languages that might break big ending.
- scotty79 1y agoI'm afraid about that too, but I hope that AI will get significantly smarter faster than it takes for any new language take popularity among humans. That it will be smart enough to not be so language sensitive. Who knows. Maybe some new fun language will pop up that's hard to write for humans, but easy to write for AI (because it can work in millisecond loop with language server, think borrow checker to the moon) and also exceedingly easy to read for humans. Because humans will, I think stil for a long time, need to debug ever shrinking corner cases where AI generated something subtly but spectacularly wrong.
- xscott 1y agoI don't know. I wrote a compiler with a syntax that's close to all the curly languages, but different in some ways. ChatGPT had no problem cranking out some test cases after I explained the rules and gave minimal examples. I guarantee it wasn't trained on any source code of my language, because none existed more than two months ago.
- 0cf8612b2e1e 1y agoWell, it has an animal mascot logo. Which is my personal yardstick for if a project is destined for success. So, off to a good start, but the lobster could be more cuddly.
- adiabatty 1y agoTo be fair, there’s a programming language out there already with a cuddly-lobster mascot. A decidedly un-cuddly lobster just maximizes product differentiation.
- lagniappe 1y agoCan I interest you in a rat named Keith, with its foot blown off?
- 0cf8612b2e1e 1y agoAt least it has personality. Not a generic, noncommittal blob.
- amy_petrik 1y agoFun story behind the name, per the language inventor Hendrik K. Grubbs, Phd. "Dr. Grubbs, what inspired the language name" "A Hooker down by the docks" "WHAT?!?" "Yes, I went to her lonely one Friday, she only cost five dollars. Next day I had a terrible itch and realized she'd given me crabs. So I confronted her the next day and asked why she had done this to me. 'What do you expect for five dollars, lobster?' "
- dang 1y agoRelated. Others? The Lobster Programming Language - https://news.ycombinator.com/item?id=44051841 https://news.ycombinator.com/item?id=44051841 - May 2025 (6 comments) The Lobster Programming Language - https://news.ycombinator.com/item?id=31453822 https://news.ycombinator.com/item?id=31453822 - May 2022 (14 comments) The Lobster Programming Language - https://news.ycombinator.com/item?id=25498005 https://news.ycombinator.com/item?id=25498005 - Dec 2020 (4 comments) The Lobster Programming Language - https://news.ycombinator.com/item?id=19567160 https://news.ycombinator.com/item?id=19567160 - April 2019 (164 comments) The Lobster Programming Language - https://news.ycombinator.com/item?id=15557060 https://news.ycombinator.com/item?id=15557060 - Oct 2017 (2 comments)
- jibal 1y ago.
- joemi 1y agoSurely you don't mean Quake the 1996 video game, so what is "Quake" in this context?
- jibal 1y agoI was mistaken ... not the author: https://quake.fandom.com/wiki/Wouter_Van_Oortmerssen_(Aardappel) https://quake.fandom.com/wiki/Wouter_Van_Oortmerssen_(Aardap...
- Aardappel 1y agoYes the author :) I make both programming languages and games / engines / maps..
- jibal 1y agoI had misunderstood a comment elsewhere and had claimed that you were the author of Quake (which I now know was developed by a team). My link above acknowledges that you are the author of some Quake maps (among many other things).
- zawaideh 1y agoFeels like it’s taking the best of Rust and Ruby (with Python style whitespace) Admittedly it’s just a first impression
- harikb 1y ago> Flow-Sensitive Type-Inference imho, I don't consider Type-inference as a good thing when it happens from 50 lines ahead/below. How would regular people follow along? Good case x = "hello" // infer type as string - good thing. Bad case var/declare x; 50 lines later if (....) x = "world" // infer type as string - this is bad
- alain_gilbert 1y agoFor case like this, I'd say your text editor should definitely just be able to tell you right away that this variable is a "string" when you mouse over it.
- harikb 1y agoIt shouldn't require a fancy forward-lookup-capable editor / language-server to show type. That is the point I am trying to make var/declare x; 25 lines later call f(x); // ** Reader has no idea what x is ... even though compiler has ** 25 lines later if (....) x = "world" // infer type as string - this is bad
- Aardappel 1y agoIn Lobster you must initialize a variable declaration. Now you can produce your bad case with `var x = nil`, but that is undesirable because nil types must be explicitly checked at compile time, so typically you want to use as few nils as possible. More likely thus is `var x = ""` if you must initialize later.
- xscott 1y agoI agree with your point in general, and I'm curious if it's a problem in Lobster. Here's one in Rust: let i = 1; let j = 1; print!("i: {:?}\n", !i); print!("j: {:?}\n", !j); // pretend there's a lot of code here // spooky action at a distance let v = vec![1, 2, 3]; v[i]; You might think those two print statements would print the same value. They do not.
- vovavili 1y agoThis feels like a scripting companion to Rust with Python-like syntax, nice one. I definitely could see it being using as a Lua replacement in embedded contexts.
- burky 1y agoYou should take a look at Koto Programming Language, I’ve been trying to keep an eye on it. https://koto.dev/ https://koto.dev/
- araes 1y agoLooks like a cool language. Like the short syntax. Impressed they implemented so much of OpenGL natively in the language. Lot of work to implement OpenGL. With such a focus, be nice to have a few more OpenGL examples. Took a bit of looking, yet found a longer example for a 2D shooter. https://aardappel.github.io/lobster/shooter_tutorial.html https://aardappel.github.io/lobster/shooter_tutorial.html However, the real test, from personal perspective, especially with a custom framework for shaders, would be implementing one of the medium difficulty LearnOpenGL 3D examples, such as the Multiple Lights example. https://learnopengl.com/Lighting/Multiple-lights https://learnopengl.com/Lighting/Multiple-lights With how much goes wrong with OpenGL and shader development, wary of delving very much into an OpenGL centric language, and then finding out there's a bunch of gotchas in the part that tends to be desirable (3D rendering). "Whoops, one of a zillion hidden flags doesn't get set properly for some reason." Texture loading seems like its there, and it says it actually uses "stb_image.h" internally. Plus, it apparently does cubemaps. Lights seem implemented, although not sure what that does "sets up a light at the given position for this frame." Model Loading is also another, from the built-ins it looks like it does .ply and .iqm? (Inter-Quake Model) files. Matrice math has a few although seems like a LookAt and Perspective matrix creator in the 4x4 category would be needed that return a matrix you can apply to a shader uniform. gl.perspective looks weird, just says "changes from 2D mode (default) to 3D right handed perspective mode" Either way, looks cool, would just like to have more examples in the target demographic, OpenGL game development. Even if they're simple. That's part of why the LearnOpenGL examples are so useful. Simple. Implementing even a significant subset would go along way toward selling me on game development in an unknown language.
- Aardappel 1y agothe "gl" namespace is really a bit of misnomer since it is much higher level API than OpenGL, and does not really depend on OpenGL. It could pretty easily run on another API underneath. The repo comes with a LOT of graphical samples (in the "samples" dir). The lights are more of standard way of passing them to the shader (see the phong shader implementation). Matrices are a bit of a weak spot since its all implicit (which is convenient, but not powerful). There are also classes for direct use of matrices though.
- babo 1y agoRunning some of the samples feels like those old SGI Iris GL demos, but implemented with a way nicer and concise language. I'll try to port some of my old code from that era.