Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Call Amber function from Bash script #253

Open
Mte90 opened this issue Jun 28, 2024 · 5 comments
Open

[Feature] Call Amber function from Bash script #253

Mte90 opened this issue Jun 28, 2024 · 5 comments
Labels
enhancement New feature or request

Comments

@Mte90
Copy link
Member

Mte90 commented Jun 28, 2024

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.

@Mte90 Mte90 added the enhancement New feature or request label Jun 28, 2024
@karpfediem
Copy link

I think it should be possible to do so per individual function, while keeping the prefix/renaming for everything else.

@Mte90
Copy link
Member Author

Mte90 commented Jun 28, 2024

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.

@Ph0enixKM
Copy link
Collaborator

Ph0enixKM commented Jul 1, 2024

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!

@b1ek
Copy link
Member

b1ek commented Jul 4, 2024

@Ph0enixKM why env? seems very out of place for me

@Mte90
Copy link
Member Author

Mte90 commented Jul 4, 2024

Maybe interpreter so in base it is compiled for sh, bash does automatically?

@Ph0enixKM Ph0enixKM changed the title Call Amber function from Bash script [Feature] Call Amber function from Bash script Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants