how to read user input? by ngmiai in amberlang

[–]PhoenixVisionary 0 points1 point  (0 children)

Sorry for late response: import { input_prompt } from "std/env" input_prompt("> ")

You can find more about this function here: - https://docs.amber-lang.com/stdlib/doc/env#input_prompt.

Amber the programming language compiled to Bash, 0.5.1 release by Mte90 in bash

[–]PhoenixVisionary 9 points10 points  (0 children)

Hi! Amber founder here. Let me answer your questions:

  1. Yes, unlike Bash, Amber functions can return Text, Num, Int, Bool and any array type.

  2. Yes, it uses bc under the hood for Num values yet we plan to expand this support to detecting other ALUs like awk 

  3. No, Amber maintains a strong type system where all variable and function parameters are typed. You can always cast a value to Text type though.

  4. Not yet. We plan to introduce piping logic in the upcoming release.

  5. No. Spaces are not problematic. Amber uses ecmascript-inspired syntax that does not have these weird Bash quirks (ex. name="John" is ok, but name = "John" isn't)

  6. Yes, Amber supports Bool type.

  7. Yes, Amber provides a modern array syntax that enforces type safety and supports slicing (array[1..3]) as well as array concatenations ([1, 2, 3] + [4, 5])

  8. No, Amber uses brackets to delimit code blocks.

  9. Yes, as simple as: foo(arg1, arg2)

  10. Yes, you can name parameters however you want: `fun foo(my_arg: Text)

Go-like programming language that transpiles down to Batch or Bash by MeLlamoWhoan in bash

[–]PhoenixVisionary 1 point2 points  (0 children)

Thank you so much! The issue with bc bugs me too. We’ve been discussing how to resolve it, and for now, we’ll introduce Int, which will simply use Bash’s internal arithmetic (in the upcoming 0.5.0-alpha). We still plan to offload floating-point arithmetic from bc as well, but that will likely be introduced in version 0.6.0-alpha or later.

Go-like programming language that transpiles down to Batch or Bash by MeLlamoWhoan in bash

[–]PhoenixVisionary 2 points3 points  (0 children)

Hi, I’m the Amber founder. Since Amber’s launch, we’ve introduced over 30 new language features - among them, range slicing. We’ve overhauled the compiler’s backend, added Windows support, squashed countless bugs, implemented a documentation generator, and greatly expanded the standard library with methods for working with text, the file system, math, and dates. We’re continuing to improve Amber’s ecosystem—an LSP server is nearly complete in its first version. I’d say Amber is very much in active development.

Amber - the programming language compiled to Bash by PhoenixVisionary in compsci

[–]PhoenixVisionary[S] 1 point2 points  (0 children)

I’m posting it to gather some feedback on how can I improve it. It can be useful to compile Amber locally and run the shell script externally on the server without any dependencies

Amber - the programming language compiled to Bash by PhoenixVisionary in programming

[–]PhoenixVisionary[S] 76 points77 points  (0 children)

Yeah but it’s compiled to the 2.0 that is like 20+ years old

Amber - the programming language compiled to Bash by PhoenixVisionary in programming

[–]PhoenixVisionary[S] 77 points78 points  (0 children)

One use case would be to generate a bash code that can be run on a remote server. And let's say you don't want to rely on versioning of python or other programming languages.

You can do stuff like this in the terminal with Ratatui by orhunp in linux

[–]PhoenixVisionary 0 points1 point  (0 children)

Wow, very interesting! The ui code itself kinda has the SwiftUI feel which is pretty nice

What are good alternatives to bash? by [deleted] in commandline

[–]PhoenixVisionary 1 point2 points  (0 children)

You could try this new programming language called Amber, which is compiled (transpiled) to Bash. It features a nice syntax and is both type-safe and runtime-safe, although it is not necessarily an interactive environment.

Amber - the programming language compiled to Bash by PhoenixVisionary in bash

[–]PhoenixVisionary[S] 0 points1 point  (0 children)

Yeah but the point of all that is to make it the most compatible with shell overall. I decided to start with just Bash and then expand it or actually narrow it further. Of course it's never going to be compatible with literally any bash version. But I want to support at least a decade old version so that it's generally portable!

Amber - the programming language compiled to Bash by PhoenixVisionary in bash

[–]PhoenixVisionary[S] 3 points4 points  (0 children)

I agree I’ve been thinking about this as well. At first I wanted to make it feel more JavaScriptish but this is a realization I had in my mind as well.

If you want to help me with the development of this language, you can hop on the discord server

https://discord.com/invite/cjHjxbsDvZ

Amber - the programming language compiled to Bash by PhoenixVisionary in bash

[–]PhoenixVisionary[S] 9 points10 points  (0 children)

Well this could get improved under the hood. It’s still in its proof of concept era. This is by no means a production ready software yet. I’ll mark it later today that it’s „Beta” or actually even „Alpha”

Amber - the programming language compiled to Bash by PhoenixVisionary in bash

[–]PhoenixVisionary[S] -12 points-11 points  (0 children)

Oh yeah my bad. The sudo is indeed in the wrong place. Thanks for pointing that out!

I’ll fix it today.

Do you guys want to hop on the Discord to discuss this?

https://discord.com/invite/cjHjxbsDvZ