Open Mte90 opened 2 months ago
I think it should be possible to do so per individual function, while keeping the prefix/renaming for everything else.
It should make sense to not rename functions and should be fine. Reading the bash generated it is just that, I think that the renaming is used only for the error reporting because includes the line of the original Amber script. Maybe for that is better to use a sourcemap or refer to the original amber script.
It is something that @Ph0enixKM can explain better then me.
Function renaming is because we have template functions and the fact that you can declare the same function with the same name in multiple files in Amber. We don't store the position of where in code is the function declared though.
I think that we can easily implement this idea you provided with some env
keyword:
env fun foo(name: Text) {
echo "Hello {name}!"
}
source amber-code.sh
foo "Adam"
# Output: Hello Adam!
@Ph0enixKM why env
? seems very out of place for me
Maybe interpreter
so in base it is compiled for sh
, bash
does automatically?
This right now is impossible as the function gets renamed with the compilation... Maybe we need a flag to compile with keeping the same function names.