Live data from Hacker News

Amber: Programming language compiled to Bash

amber-lang.com

151–160 of 330 posts

Re: Amber: Programming language compiled to Bash

#151
I haven't seen a mention of the Oil Shell (https://oilshell.org) project's OSH/YSH yet and I'm quite surprised.

Oils goal is that OSH is just a new Bash implementation (although not bug-for-bug) but with an upgrade-path to the more modern YSH for real programming with type safety etc, but still as a shell language. One of their exciting ideas is using code as data in a somewhat lisp-like manner to allow function introspection in YSH etc.

Based on other comments it seems like Oil Shell is much more principled in working to actually understand Bash as it exists and presenting an alternative language. I would be interested in what differentiates Amber and whether they have a response to Oils?

Re: Amber: Programming language compiled to Bash

#152

Assuming that these are typical outputs from Amber: https://github.com/Ph0enixKM/Amber/blob/master/setup/install... https://github.com/Ph0enixKM/Amber/blob/master/setup/uninsta... The inconsistent indents and decorated variable names made them less readable than hand-written Bash scripts. I understand that most compiler outputs are not meant to be human readable, but generally we would get minification and/or obfusca…

And why is it using [ instead of bash native [[

Re: Amber: Programming language compiled to Bash

#153

I like the idea, but the example suggests that it invokes external programs for trivial stuff, like comparing a variable to an integer (invokes bc and sed). I would prefer if it compiled to pure bash, and only invoked external programs if explicitly called for. But I guess emulating some feature in pure bash is hellish, that's exactly I don't want to write that manually either though.

Maybe it's targeting that ancient GPLv2 bash (that MacOS still ships for ideological reasons).

Re: Amber: Programming language compiled to Bash

#155

Why does the documentation need WebGL? I have WebGL disabled in my main browser for privacy reasons (super-easy to fingerprint), and I only get to see 'Application error: a client-side exception has occurred (see the browser console for more information).' with an error about ThreeJS initialization in the console. I assume it's for the fancy animation, and I find that ridiculous. Loading a whole 3D library just to sh…

'WebGL disabled' is a pretty strong fingerprint anyways

What?

Not nearly as uniquely identifiable as your GPU model.

Re: Amber: Programming language compiled to Bash

#156

I love the concept of a language like this, though I haven't evaluated amber in detail. I want to do more complex things using bash for devops stuff, because it's mostly working with other command line tools. You could directly use APIs and SDKs of cloud providers, but then things become an order of magnitude more complex than just writing the bash script. However, when you do that you encounter bash's weaknesses, li…

I sort of see that, but at the same time why not just compile to python instead? I get that python can be less convenient syntactically for "scripting" type things, but if you're writing in what's effectively a DSL that gets transpiled for a different interpreter anyway...

Re: Amber: Programming language compiled to Bash

#157

Earlier quoted context omitted.

Why doesn’t Amber have equivalent issues? Such as depending on a specific version of bash, or specific executables to be installed. Also does bash run on windows outside of WSL? Amber seems to argue that it doesn’t support Windows because Windows doesn’t support bash. That would cut against the idea that bash can target more devices than Python, which runs natively on all platforms.

> Also does bash run on windows outside of WSL? Git Bash is pretty ubiquitous on developer machines in my experience.

"pretty ubiquitous" is what I'm referring to here. OP seemed to imply that because the other options have "non-zero friction" that targeting bash has zero friction. But you have to make sure bash is there, and if it's not, you have to install a toolchain that may include an entire operating system.

I guess I just don't understand how having the user install git bash or WSL any different from having them install Python or JVM?

Re: Amber: Programming language compiled to Bash

#158

What I really want for scripting usecases is a language that has modern language concepts (easy to use arrays and maps, text formatting strings, etc) but that allows me to call commands as easily as I could call functions. Maybe there are existing scripting langs that make this so? Ambers approach is not bad but I feel it could be even better.

Rash (https://rash-lang.org/) and Oil (https://www.oilshell.org/release/latest/doc/ysh-tour.html) come to mind. Xonsh, too, as mentioned. Powershell too.

Most high-level languages have packages that implement DSLs for running and connecting subprocesses. Python has both `subprocess` in stdlib and things like plumbum (https://plumbum.readthedocs.io/en/latest/index.html) or fabric as 3rd party packages. Scala has a little DSL ("echo 1" #| "cat" !) for this in stdlib. How lightweight the syntax is depends on how DSL-friendly the language is, so things like Ruby or Raku might be your best bets.

Re: Amber: Programming language compiled to Bash

#159

Earlier quoted context omitted.

Why doesn’t Amber have equivalent issues? Such as depending on a specific version of bash, or specific executables to be installed. Also does bash run on windows outside of WSL? Amber seems to argue that it doesn’t support Windows because Windows doesn’t support bash. That would cut against the idea that bash can target more devices than Python, which runs natively on all platforms.

> Why doesn’t Amber have equivalent issues? Such as depending on a specific version of bash, or specific executables to be installed. Because it's easy (for most cases) to write backwards-compatible or portable shell scripts and, since Amber is compiled, it can simply generate backwards-compatible code. > That would cut against the idea that bash can target more devices than Python, which runs natively on all platfor…

Only the ancient GPLv2 bash is actually ubiquitous and you might as well just target POSIX's sh if that's the argument.

Re: Amber: Programming language compiled to Bash

#160

Earlier quoted context omitted.

> Even if you're convinced you need the fancy animation, why not gracefully fallback to not showing it and still make the docs usable? Yeah, it's not like adding a try/catch block around the webGL invocation was hard anyway… But I agree with the sibling comment about disabling WebGL likely being a fingerprinting liability more than a win.

If you disable WebGL you're putting yourself in the 2% of devices that don't support it. That's not fantastic, but with WebGL enabled just the extension list can be used to narrow you down way further than that - according to https://amiunique.org/ 0.35% of users share my exact supported extensions list. My `gl.getParameter(gl.RENDERER)` seems to be unique to me, for some ungodly reason. The output from rendering a s…

Using firefox on a mac is basically enough to put me as all time unique on that site.
Post reply on HN