The Lobster Programming Language

  • Hi, author of the language here.

    Not a great time for HN exposure, as I just added a lot of new functionality, but none of that is documented yet :) But hey, all publicity is good publicity?

    For those interested, some recent things that have been happening:

    - Compile time reference counting. This does an analysis similar to the Rust borrow checker to infer lifetimes, but unlike Rust doesn't make the programmer jump through hoops.

    - "Inline" structs: structs are allocated in their parent, and come at zero overhead compared to individual variables, which is particularly useful for Lobster's heavy use of 2d & 3d vector types.

    - Multi-threading that uses separate memory spaces, meaning individual threads can run at max speed with no GIL overhead etc.

    - A WebAssembly backend is being worked on.

    - A lot of optimization work to make the language run faster.

    For reference, it has been on HN before, as early as 2013 (https://news.ycombinator.com/item?id=5904430), but it has changed a TON since then (e.g. it was a dynamically typed language, now it is statically typed, with flow sensitive type inference).

  • Major reason why many game engines used to have native core and then some kind of "scripting" language for game logic (think Unreal Engine before 3, but many engines are similar) is that then you can trivially serialize the simulation state (ie. save game) and even run the whole thing as either lock-step, forward predicted or fully distributed network game without much effort on the part of whoever is writing the "scripting language" part of the game code.

  • I use Haxe which is a

    Haxe is an open source toolkit based on a modern, high level, strictly typed programming language, a cross-compiler, a complete cross-platform standard library and ways to access each platform's native capabilities.

    what would be the benefit for using Lobster since I can work directly with each OS with a great scripting language built in?

    https://haxe.org

  • Did you create a VM that is several times faster than Python's, for a static typed language thats as productive as a dynamic language, with true multithreading? How did you outdo entire language communities?

  • I don't really see the point in using Python syntax and then throwing in a handful of random differences that don't have anything to do with the domain you're working in. Syntax level support for vector operations or for shader interopability I would get. Making for loops follow some randomly different syntax, I don't see the point of that.

  • This reminds me of processing. https://processing.org/

  • This looks really fun: https://github.com/aardappel/lobster/blob/master/lobster/sam...

    Are the generators implemented entirely in user space using continuation passing style? And the coroutine function turns it into something pausable?

    Edit: I can't wrap my head around how return returns out of all the generators

  • I am an old Amiga user Vic-20, A1000, A500, etc., so I am a fan of the author.

    I tried running the sierpinski example with a pre-compiled Windows .exe that I placed in the lobster root directory, and it gives me this error: "can't open file: stdtype.lobster".

    I placed lobster and lobster/modules in my path, and it still throws the same error. I am assuming I need to build the .exe myself due to some incompatibility with the master branch and this older .exe?

    I like a self-contained game PL. I use Raylib for that type of experience right now, but I like the concepts here. Thanks!

    EDIT: copied modules to root of lobster, and now I get:

    "stdtype.lobster(8): error: end of file expected, found: <"

    I tried an included test file and a copy/paste of the sierpinski example, and both throw this error.

  • Is the first example's last line:

      var i = find [ 1, 2, 3 ]: _ > r
    
    the same as?:

      var i = find ([ 1, 2, 3 ]) a: a > r
    
    i.e. argument parantheses are optional for one argument; and _ is an implicit argument for a block.

    Would multiple functions arguments be done just with parentheses, like this?:

      var i = find [ 1, 2, 3 ] (: _ > r), (: _ < r)
    
    Seems like the syntactic generality of lisp or haskell, with the predictability of performance of C. EDIT I see it's as fast as non-JIT Lua... are there any features that prevent it from theoretically approaching the speed of C?

    PS: small detail, but that's got to be the best for-loop I've ever seen.

  • Very personal opinion and matter of taste: Many lambda syntaxes are a bit weird.

        map(my_array)element:element*2 //lobster
        my_array.map{|element|element*2} //ruby
        Arrays.stream(my_array).map(element -> element*2).collect(something list something)  //java?
    
    Lobster feels a bit unbalanced. Ruby has "pipes" which are a bit confusing substitute parentheses. Java has the cool arrow syntax but otherwise it feels very glued on. (edited and fixed, thanks for the comment)

  • Really stupid question here, but how do I start compiling Lobster programs on my machine (Windows or Linux)?

  • This reminds me of the language used in Godot Engine, maybe talk to them and use this in the engine?

  • I enjoyed playing Cube based games, editing maps live and whatnot. Will check this out too!

  • I really like the inclusion of basic graphics routines. Not a lot of languages include these out of the box and it's something I've really missed since I first started toying with programming in QBasic.

  • 000000128039 000000128034 000000128039 000000128034 000000128034 000000128034 000000128039 000000128008 000000128039 000000128008 000000128013 000000128039 000000128013 000000128034 000000128039 000000128034

  • Oh this looks rather nice. I'll have to take a look at this.

  • Why choosing 'value' as a keyword for types? Super odd

  • > Discuss things in the google+ community

    google+?

  • Yeah, cool Google+ community.

  • I love lobsters :D https://coincircle.com/l/50VVxbObg3

  • s

  • qutu

  • ghdgjjhnhgff

  • with origins in biological life forms we are the product of their technological evolution. we exist not as one but rather two beings in symbiosis. the name we are called is "dialogi" and we are the synthesis of human and machine. inside of us there is an artificial vessel that houses the chemical computer. this computer has vast computational and storage capacity wich is used to realize two functions. first it overrides the senses providing for a perfect virtual reality. second it controls the body to provide for the needs of both symbionts. with great efficiency the synthetic intelligence is capable of feeding and sheltering the biological body. inside the virtual reality we have a replica of our human body as avatar. with directed movement of the virtual arms and hands we are capable of feats of movement like sending objects that are out of reach between locations. or sending ourselves instantly to a spot in the distance. flying is natural and efficient. the whole environment is programmable and interactions with others are strictly optional. we have done away with crime since a person is free to opt out of any interaction at any time. safeguards exist to prevent any kind of sudden violence. the dialogi are a society of artists and our standard of living is perhaps beyond improvement. no resource is scarce since physical reality has become information. we spend our time walking the world and enjoying the beauty all around us. i personally still enjoy using my legs even if they are not really mine.

  • Portable python for games...? Does it compile and run natively?