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] Make declarations of function to be POSIX compliant #334

Open
Ph0enixKM opened this issue Jul 22, 2024 · 4 comments
Open

[Feature] Make declarations of function to be POSIX compliant #334

Ph0enixKM opened this issue Jul 22, 2024 · 4 comments
Labels
compiler enhancement New feature or request

Comments

@Ph0enixKM
Copy link
Member

Is your feature request related to a problem? Please describe.
Currently functions generated by Amber are only bash compliant. Let's use the POSIX syntax for declaring functions.

Describe the solution you'd like
Change from:

function foo() {
	# ...
}

to:

foo() {
	# ...
}

Describe alternatives you've considered
N/A

Additional context
This problem is related to the milestone to support sh

@Ph0enixKM Ph0enixKM added the enhancement New feature or request label Jul 22, 2024
@Mte90 Mte90 added the compiler label Jul 23, 2024
@Mte90
Copy link
Member

Mte90 commented Jul 23, 2024

If we implement this we need to add also a flag to Amber to define the bash version to support

@Ph0enixKM
Copy link
Member Author

@Mte90 the POSIX version is supported by Bash and SH. Migrating to the POSIX version will not affect the existing bash compatibility

@Mte90
Copy link
Member

Mte90 commented Jul 31, 2024

I was trying to understand where in the code write function to remove it but I don't find it

syntax_name!("Function Invocation");

@Ph0enixKM
Copy link
Member Author

@Mte90 it's right here:

result.push(format!("function {name} {{"));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants