New favorite tool 😍

  • sudo42@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    6 months ago

    One day, someone’s going to have to debug machine-generated Bash. <shivver>

    • shutz@lemmy.ca
      link
      fedilink
      arrow-up
      0
      ·
      6 months ago

      You can do that today. Just ask Chat-GPT to write you a bash script for something non-obvious, and then debug what it gives you.

    • Tyfon@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      6 months ago

      Bash is one of the most used shell language, it’s installed on almost all Linux and Mac systems and can also be used on windows. Almost no one likes writing it as it is convoluted and really really hard to read and write. There are many replacement language’s for it, but using them is troublesome, because of incompatibilities. Amber is compiled which will solve problems with compatibility and it seems that language itself is very readable. On top of that it has most futures that modern programmers need.

    • jack@monero.town
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      6 months ago

      There is no sh shell. /bin/sh is just a symlink to bash or dash or zsh etc.

      But yes, the question is valid why it compiles specifically to bash and not something posix-compliant

        • jack@monero.town
          link
          fedilink
          arrow-up
          0
          ·
          edit-2
          6 months ago

          Yes, there was the bourne sh on Unix but I don’t see how that’s relevant here. We’re talking about operating systems in use. Please explain the downvotes

          • BatmanAoD@programming.dev
            link
            fedilink
            arrow-up
            0
            ·
            6 months ago

            It’s relevant because there are still platforms that don’t have actual Bash (e.g. containers using Busybox).

            sh is not just a symlink: when invoked using the symlink, the target binary must run in POSIX compliant mode. So it’s effectively a sub-dialect.

            Amber compiles to a language, not to a binary. So “why doesn’t it compile to sh” is a perfectly reasonable question, and refers to the POSIX shell dialect, not to the /bin/sh symlink itself.

  • 4wd@programming.dev
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    6 months ago

    The language idea is good, but: THREE.WebGLRenderer: A WebGL context could not be created. Reason: WebGL is currently disabled.

    Seriously? Why do I need WebGL to read TEXT in docs? :/

  • popcar2@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    ·
    6 months ago

    Compiling to bash seems awesome, but on the other hand I don’t think anyone other than the person who wrote it in amber will run a bash file that looks like machine-generated gibberish on their machine.

    • FizzyOrange@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      6 months ago

      I disagree. People run Bash scripts they haven’t read all the time.

      Hell some installers are technically Bash scripts with a zip embedded in them.

    • zalgotext@sh.itjust.works
      link
      fedilink
      arrow-up
      0
      ·
      6 months ago

      Compiling to bash seems awesome

      See, i disagree because

      I don’t think anyone other than the person who wrote it in amber will run a bash file that looks like machine-generated gibberish on their machine.

      Lol I barely want to run (or read) human generated bash, machine generated bash sounds like a new fresh hell that I don’t wanna touch with a ten foot pole.

  • morrowind@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    6 months ago

    How is it using something like this vs just a bash alternative. Can you use this in the shell or only as a compiled language?

  • Eager Eagle@lemmy.world
    link
    fedilink
    English
    arrow-up
    0
    ·
    6 months ago

    with no support for associative arrays (dicts / hashmaps) or custom data structs this looks very limited to me

    • FizzyOrange@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      6 months ago

      Does Bash support those? I think the idea is that it’s basically Bash, as if written by a sane person. So it supports the same features as Bash but without the army of footguns.

      • BatmanAoD@programming.dev
        link
        fedilink
        arrow-up
        0
        ·
        6 months ago

        A language being compiled should be able to support higher-level language concepts than what the target supports natively. That’s how compiling works in the first place.

        • FizzyOrange@programming.dev
          link
          fedilink
          arrow-up
          0
          ·
          6 months ago

          That depends on how readable you want the output to be. It’s already pretty bad on that front. If you start supporting arbitrary features it’s going to end up as a bytecode interpreter. Which would be pretty cool too tbf! Has anyone written a WASM runtime in bash? 😄

  • ReluctantMuskrat@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    6 months ago

    As a long-time bash, awk and sed scripter who knows he’ll probably get downvoted into oblivion for this my recommendation: learn PowerShell

    It’s open-source and completely cross-platform - I use it on Macs, Linux and Windows machines - and you don’t know what you’re missing until you try a fully objected-oriented scripting language and shell. No more parsing text, built-in support for scalars, arrays, hash maps/associative arrays, and more complex types like version numbers, IP addresses, synchronized dictionaries and basically anything available in .Net. Read and write csv, json and xml natively and simply. Built-in support for regular expressions throughout, web service calls, remote script execution, and parallel and asynchronous jobs and lots and lots of libraries for all kinds of things.

    Seriously, I know its popular and often-deserved to hate on Microsoft but PowerShell is a kick-ass, cross-platform, open-source, modern shell done right, even if it does have a dumb name imo. Once you start learning it you won’t want to go back to any other.

    • caseyweederman@lemmy.ca
      link
      fedilink
      arrow-up
      0
      ·
      6 months ago

      I appreciate you sharing your perspective. Mine runs counter to it.
      The more PowerShell I learn, the more I dislike it.

      • jelloeater - Ops Mgr@lemmy.world
        link
        fedilink
        English
        arrow-up
        0
        ·
        6 months ago

        As someone who spent 2 years learning and writing PowerShell for work… It’s… Okay. Way easier to make stuff work then bash, and gets really powerful when you make libraries for it. But… I prefer Python and GoLang for building scripts and small apps.

      • ReluctantMuskrat@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        6 months ago

        I do. Currently I use it mostly for personal stuff as part of my time spent on production support. Importing data from queries, exporting spreadsheets, reading complex json data and extracting needed info, etc. In the past when I was on DevOps used it with Jenkins and various automation processes, and I’ve used it as a developer to create test environments and test data.