Since I’m having untracable issues with Lua due to its API and lackluster documentation, I’ve decided to drop it from my game engine (PixelPerfectEngine) in favor of some easier to use alternatives.

What I need is:

  • open source
  • small footprint even if it at the cost of some complexity (I need it as a scripting engine, not as a replacement for compiled application languages)
  • integer support (I don’t care if I could just round it on the backend)
  • C or C++ ABI
  • can be embedded into a software (yes, there are people that suggest you to use janky solutions like passing data in files and command line)

Even a better Lua implementation would suffice, and if I had the time, I would port the official one to D (my main language), while getting rid of the godawful stack method of control.

  • Shareni@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    1 year ago

    Check out scheme. The syntax is incredibly simple. Watch like the first 20 minutes of a first sicp lecture, and you’ll know enough lisp to read basic scheme.

    Macros are magic, and I’m guessing they would be really useful for you to abstract interactions with the engine. Check out the for macro and how it’s compared to the standard loop macro. Both implement a DSL to make iteration both simpler and easier to read (if you understand the specific language of the macro).

    • open source
    • Licence will depend on the implementation, but I think most are open source. Guile was the GNU champion in the embedded language war. Also, you can go full GNU with GNU make, GCC, and GNU guile.
    • small footprint even if it at the cost of some complexity (I need it as a scripting engine, not as a replacement for compiled application languages)
    • Scheme’s whole thing is to be minimal, while letting you make anything you need. For example the r5rs specification is 50 pages long, and I think has recursion as the only iteration method. Specific implementations add additional features like while loops.
    • integer support (I don’t care if I could just round it on the backend)
    • I’m not sure what you mean by int support, but there should be exact/inexact and “convert between them” functions for numbers. Check out the scheme specs and implementation docs for specifics.
    • C or C++ ABI
    • interop also depends on implementation, but guile should be pretty good.
    • can be embedded into a software (yes, there are people that suggest you to use janky solutions like passing data in files and command line)
    • there are a few schemes made specifically for embedding

    Documentation is really varied. Also, schemes usually don’t have all that much online info available, but the bigger ones have good communities.

    Just to warn you, you’re probably going to end up using Emacs if you decide to work with scheme. Doom Emacs is great. For magic check out lispy and paredit.