1. 31
  1.  

  2. 16

    Fennel maintainer here; ask me anything!

    It’s looking like this might be the last release before 1.0.0. The biggest remaining potential change is reader macros: https://todo.sr.ht/~technomancy/fennel/28

    1. 4

      This looks cool. Are you aware whether/how well it works with LOVE2D and whether there any games built with it that have source available?

      1. 3

        There’s been a load of love2d games, yeah, including several open source ones that have won game jams: https://github.com/bakpakin/Fennel/wiki/Codebases#l%C3%96ve-games

        I might even go so far as to say that making love2d games is the most popular thing to use Fennel for.

        1. 3

          Wow. Very nice. Thank you. I may have to give it a try… I like love2d quite a lot, but seem to find a stupid lua rat hole once per project. The fennel REPL looks like a really big upgrade over my current approach.

          1. 3

            You probably know this but getting a repl in love2d is a little trickier than you might expect given that there’s no way to read from stdin without blocking the whole thread. There’s a bit of boilerplate here that sets up a separate thread to do the blocking read and communicates with the main thread using love2d channels: https://gitlab.com/alexjgriffith/min-love2d-fennel

            Be sure to drop by #fennel on Freenode or matrix.org if you have any questions!

      2. 3

        Does fennel have a way to draw to the screen?

        Does fennel have a way to open files?

        Does fennel have a way to deal with binary?

        Thanks! And great job.

        1. 9

          Does fennel have a way to draw to the screen?

          Fennel compiles to Lua, so the answer here would be the same as the answer to whether Lua can draw to the screen. Not out of the box, but there’s definitely ways to make it happen. The easiest is using love2d but you can use SDL directly too, like lite which is a 4kloc extensible text editor.

          Does fennel have a way to open files?

          This one IS built-in:

          (with-open [f (assert (io.open "foo.txt"))]
            (print (f:read :*all)))
          

          Does fennel have a way to deal with binary?

          In Lua, strings are not defined as having any encoding. This can cause problems in some contexts, but it means that they are suitable for use with binary data. (There is UTF8 support, but strings are not required to stick to UTF8 data.)

          Hope that helps!

          1. 1

            lite

            CMIIW, but aren’t the GUI bits of lite written in c?

            1. 1

              Yes, SDL is a C library so any interaction (from nearly any language) would require a small bit of shim code in C. Usually in a library, but in lite they opted to inline it for fewer dependencies.

        2. 1

          I am not really Lua developer, but is it possible to use loader with LuaJIT? I was trying to make Fennel work as NeoVim configuration language, but I have encountered problems with loader. I may try to just precompile scripts, but having it as a loader would be for sure an interesting thing.

          1. 3

            I’m not a vim user, but lots of people use Fennel to extend NeoVim and it seems to work great. The best-documented example is https://github.com/Olical/aniseed though I’m not sure I can recommend that one specifically since it lumps together the vim extension mechanism along with its own module system that adds a lot of complexity over Fennel’s. But it might be useful as an example.

            The fennel.searcher function does work fine with LuaJIT’s package.loaders; in fact this is what I use for all my love2d games.

            Edit: if you have a specific problem you’ve run into, feel free to bring it up on the mailing list or IRC/Matrix channel.