amber-lang / amber

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

[Feature] Make `exit` function a builtin #285

Open Ph0enixKM opened 2 weeks ago

Ph0enixKM commented 2 weeks ago

Is your feature request related to a problem? Please describe. exit(code: Num) function is so simple and universal that it could be a builtin exit code:Num

Describe the solution you'd like The following syntax:

exit 1

Remove the following function from std lib:

exit(1)

Describe alternatives you've considered N/A

Additional context This introduced a breaking change

b1ek commented 2 weeks ago

i wonder if exit is considered infallible. afaik we have decided sometime before that we add only infallibles to builtins, right?

Ph0enixKM commented 2 weeks ago

i wonder if exit is considered infallible. afaik we have decided sometime before that we add only infallibles to builtins, right?

I think that it’s as infailable as echo so we can assume it’s infailable

b1ek commented 1 week ago

tbh i dont think that even echo is infallible. there are some conditions where there is no fd 1, right?

Ph0enixKM commented 1 week ago

@b1ek Yeah. But then can we even run anything bash related?