My primary use case for Amber is when I need to write a Bash script but don’t remember the silly syntax. My most recent Bash mistake was misusing test -n and test -z. In Amber, I can just use something == "" or len(something) == 0

  • gtrcoi@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    5 months ago

    I get why this is useful, and it’s useful for me as well, but the perfectionist in me asks why target bash instead of posix?

    • sga@piefed.social
      link
      fedilink
      English
      arrow-up
      3
      ·
      5 months ago

      my guess is mostly lack of arrays in posix shell. there are other things as well, but arrays are really useful, especially when they are making other things easier to write. A stupid comparison i can think of is a compiled language targettng x86-64v2 or 3 instead of v1 because it has avx (i am not actually sure when avx was added, but imagine some instruction being added). without avx, your binary would be slower (in posix, for arrays, you essentially need to maintain a string and use awk/sed/cut to get particular elements, and many things would just not be possible). If they would target v1 (posix), it will run in more places, but it would be slower for a lot of people who have v2 or newer. And a lot of people have v2 or newer (bash).

    • lens0021@programming.devOP
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      5 months ago

      Currently, Amber does not even support Bash 2 because Bash 2 does not support the += operator. (ticket) However, I believe that POSIX compliance is on Amber’s long-term milestone, and that it will eventually achieve this as its support range expands.

    • Jakeroxs@sh.itjust.works
      link
      fedilink
      arrow-up
      1
      ·
      5 months ago

      As someone who knows nothing about POSIX, what’s the difference or in your opinion what would make it specifically better with the context of amber?

      • gtrcoi@programming.dev
        link
        fedilink
        arrow-up
        3
        ·
        5 months ago

        To add to the great response from @confusedpuppy@lemmy.dbzer0.com, amber would address one thing only: writing the syntax.

        Most people don’t need it, and even if they had it would break the compliance in other ways besides syntax, but I’m sure there are people out there that know what they are doing who would appreciate amber.

        Amber will still support bash stuff, or perhaps even other non-posix shells through the use of flags.