Live data from Hacker News

Amber the programming language compiled to Bash/Ksh/Zsh

amber-lang.com

51–60 of 72 posts

Re: Amber the programming language compiled to Bash/Ksh/Zsh

#51
post #7

> Typescript to bash Literally the worst of both worlds.

bash bashing i can understand. whats wrong with ts tho?

Everything, when other options are available? The strongest argument for Typescript is that it isn’t JavaScript, which doesn’t apply here.

Re: Amber the programming language compiled to Bash/Ksh/Zsh

#52

In a world where AI can generate any code for any environment, is there a need for another language? On the other hand, we're at a point for a binary language (or standard / framework) that one AI/LLM creates and another one validates. What are we missing?

You guys can stop down voting. This is not something we're advocating, instead talking the reality from observing across the industry.

I wonder what notable thing has the "industry" produced during your observation (apart from more JIRA tickets).

Re: Amber the programming language compiled to Bash/Ksh/Zsh

#53

Earlier quoted context omitted.

bash scripting has ergonomics?

Regardless of where it’s deployed I can edit it and run it without any additional tools.

So does an amber script after it's been compiled, that's the whole point. You can tweak it and inspect it if you want. Realistically though you'll probably regenerate it and copy the new compiled version over. But you can do both.

Re: Amber the programming language compiled to Bash/Ksh/Zsh

#54
post #7

> Typescript to bash Literally the worst of both worlds.

Bash is great for orchestrating other Unix tools into an automated workflow. Only when that workflow requires stuff that Bash doesn't have is it time to break out Python. Integrate Shellcheck into your editor, and you get automated help for writing more reliable Bash.

ShellCheck is like a spaz hall monitor, filling my editor with useless warnings about what it believes are best practices. I thank my stars I mostly write shell scripts in zsh which it doesn't support.

Re: Amber the programming language compiled to Bash/Ksh/Zsh

#55

unclear use case imo - this sacrifices the ergonomics of actual bash scripting, and hides it behind another language If your script is complex enough to need a higher level language you might as well just switch to python

bash scripting has ergonomics?

Yes?

Re: Amber the programming language compiled to Bash/Ksh/Zsh

#56
post #27

Earlier quoted context omitted.

Because it's not preinstalled on every machine. Bash is a good target for portability reasons, but it's a shitty language to write in. If ever I get in the position again to have to write some bash, like for an installer or so, I'm going to be looking into Amber again.

portability but not posix shell? tsk tsk

Portability is dead now anyways. Something can have "sh" but all you can depend on are sh semantics and built ins. The whole point of a shell script is to compose a larger workflow out of the command line tools preinstalled on a system. I can't guarantee a sh script written on macOS is going to work on FreeBSD or Linux anyways, so there's zero reason to limit myself to sh.

Re: Amber the programming language compiled to Bash/Ksh/Zsh

#58
post #54

Earlier quoted context omitted.

Bash is great for orchestrating other Unix tools into an automated workflow. Only when that workflow requires stuff that Bash doesn't have is it time to break out Python. Integrate Shellcheck into your editor, and you get automated help for writing more reliable Bash.

ShellCheck is like a spaz hall monitor, filling my editor with useless warnings about what it believes are best practices. I thank my stars I mostly write shell scripts in zsh which it doesn't support.

It does have some "false positives" but by and large I find it helpful. I never saw a script misbehave where I followed Shellcheck's advice.

Re: Amber the programming language compiled to Bash/Ksh/Zsh

#59

Earlier quoted context omitted.

How many places do you have Bash, but not AWK?

Or Perl. Or Python. How many environments have only bash and not awk, perl, or python?

For small stuff I use bash / sed / awk / jq / yq / curl etc. I stopped using perl (a long time ago) and hate trying to build or distribute anything in Python. "You asked for a script! I give you... a venv, a pip install, woops need to compile something, so let's install build tools. Actually let's get github actions set up to handle this, or would you prefer a Docker image? Do you have a registry so I can share the image? Wait are you using a Mac? Multiarch image time! Or should I just give you a bag of scripts and a Dockerfile? Oh you're using Podman rootless, need you to read this page on how to access your own files as "you" in your container. Shit the wheels fell off! But look, Python is amazing and can do lots of stuff bash / curl / jq can't do!"

So these days I almost exclusively use Go wherever bash and friends aren't enough. Compile to Linux x86 & ARM and Darwin ARM, or just "go run" if it's simple enough.

Re: Amber the programming language compiled to Bash/Ksh/Zsh

#60

Any language is a shell script if you're brave enough: https://en.wikipedia.org/wiki/Shebang_%28Unix%29

Can go one step further and define a custom binfmt like was done here https://blog.cloudflare.com/using-go-as-a-scripting-language...
Post reply on HN