In short, Amber is a programming language with Rust like syntax that compiles down to bash. More details here: https://amber-lang.com/

On the surface, it seems nice. Cleaner syntax, types, compile-time safety checks, etc. So you get to write in something nicer than bash but get the portability of bash.

My wonder is if there are pitfalls that make it worse than instead writing it in something like Python or even bash itself. I’d guess the generated bash code probably isn’t the prettiest to look at or debug.

  • Quibblekrust@thelemmy.club
    link
    fedilink
    English
    arrow-up
    19
    ·
    1 day ago

    It’s not Rust, OP was mistaken. It’s ECMA-Script-like with Rust-like features and also Python-like features.

    I think the idea is, you can develop Amber scripts “at home” then deploy them on any machine that has Bash without needing to install anything. This benefits system admins.

    Amber compiles directly to shell code, so you can:

    • Leverage existing shell tooling and pipelines.
    • Deploy a single script without installing a language interpreter.
    • Benefit from shell‑native features (process substitution, job control) while enjoying high‑level syntax and safety.

    Is Amber production‑ready?

    In the the project it is production ready because it is already used in this context because the shell code generated is tested and confirmed that works, the language is evolving with the tooling set.

    Well, their FAQ isn’t exactly production ready.

      • Quibblekrust@thelemmy.club
        link
        fedilink
        English
        arrow-up
        4
        ·
        14 hours ago

        Yeah, it’s a blurry line whether to call it rust-like if it borrows features, when actually most syntax is more like ECMA Script or Python. So I shouldn’t really have said “OP was wrong”. But they also kind of are. I dunno.

    • False@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      23 hours ago

      Eh, go is really good for this kind of stuff. It compiles to a single binary you can just execute from shell

        • False@lemmy.world
          link
          fedilink
          arrow-up
          3
          ·
          13 hours ago

          I’d say no. Even C needs external libraries.

          I guess Rust does this too though - in which case transpiling rust to bash is even less appealing :shrug:

          • Quibblekrust@thelemmy.club
            link
            fedilink
            English
            arrow-up
            3
            ·
            edit-2
            11 hours ago

            Even C needs external libraries

            You can compile a C program while statically linking the libraries, thereby producing a single binary with no runtime dependencies. Just because Go can do this, too, doesn’t mean it’s special. It’s just that most libraries for Go ship as source code and not as compiled libraries. But as soon as you import some actual library like Sqlite, OpenSSL, GTK or whatever, using some wrapper codr, you’re going to have the same dependency issue.

      • CameronDev@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        15 hours ago

        Rust is the same mostly. One upside of bash is that if binary signing was enabled, go and rust binaries would get blocked, but bash would be fine.