Live data from Hacker News

Amber the programming language compiled to Bash/Ksh/Zsh

amber-lang.com

41–50 of 72 posts

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

#41
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.

Great compared to what? It was great in the ‘90s, not today.

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

#43
post #21
post #19

Earlier quoted context omitted.

Exactly #!/usr/bin/tcc -run #include int main(int argc, char **argv) { printf("Hello from C!\n"); for (int i = 1; i And ready is your cscript :) $ chmod u+x cscript && ./cscript hello world Hello from C! argument 1: hello argument 2: world (I can't even articulate why I love it so much that this works)

Can you change the current working directory? If not, it's not a shell script.

Of course you can. How do you think `cd` utility is implemented?

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

#44

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?

> is there a need for another language? If you know of a language that is perfect for all our needs today and tomorrow, please guide us to it. > What are we missing? Major concerns would be i) trust in the tooling, ii) quality and accountability, iii) future investment in competent engineering.

True, There isn't one, there will be never one. Isn't that how we end up so many and it never ends.

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

#45
post #30

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?

Do we really want to stop evolving the space of languages (and libraries and frameworks while we're at it) just because we have LLM's writing code now? If LLM's were truly smart, they'd argue with us that we should stop asking them to write bash code, because it's a shitty error-prone language. True intelligence should be skeptical of itself and not take any request as a requirement.

Agreed, not our choice but isn't that the reality now?

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

#46

This looks great. We have a lot of bash tools because it's the only stable interpreter that we have readily available on all our systems. But bash is a pain to write so this might actually make things easier.

I had a small project that embedded the Lua interpreter in scripts as base64, which allowed me to write shell scripts in Lua, since it carried the interpreter with it. About 270k of bloat to make it work, though.

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

#47

Earlier quoted context omitted.

Presumably you can call chdir(2) from the C code? Or did you mean change the directory of the calling shell (in which case, executable shell scripts written in Bash and friends can’t do that either).

Well, you can "source" a script, so its effects persist in your current shell session. That's a feature of the script and your shell sharing the same language.

Then it seems that what you want is running a repl of your chosen language rather than shell/"executable" scripts.

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

#48

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.

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

#49
post #27

Hm... But why not use Python

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

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

#50

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

The only thing I can think of is if you have an existing system you are integrating with thats implemented in shell script already - for example a packaging or build pack system; but I can’t really see how this could be justified even there because this could easily be a toy that becomes abandoned.

A really common use case is install/bootstrap/setup scripts. You know, those sketchy curl-to-bash things, or cloud-init scripts, or whatever you run to set up your actual higher level tools like Python.
Post reply on HN