Ph0enixKM / Amber

💎 Amber the programming language compiled to bash
https://amber-lang.com
GNU General Public License v3.0
3.51k stars 67 forks source link

String with ! fails #243

Open Mte90 opened 3 days ago

Mte90 commented 3 days ago

Try this code:

let var = unsafe $echo "\${\!var}"$

Generates that report the \ near the !:

Expected expression
at ./test.ab:1:26

1| let var = unsafe $echo "{\!var}"$

Instead should work and generate a bash code like var = echo "${!var}", this blocks https://github.com/Ph0enixKM/Amber/pull/185

b1ek commented 1 day ago

why should this work? i dont remember ! being a valid amber keyword. is your variable named !var?

Mte90 commented 1 day ago

Because that is a valid Bash code and it is required to let the #185 working.

Mte90 commented 1 day ago

I found an explanation of ${!var} in bash https://stackoverflow.com/questions/8515411/what-is-indirect-expansion-what-does-var-mean