Replies: 3 comments 1 reply
-
Another question I forgot to ask: Is ease of arg parsing seen as something that would be fair game for Amber to tackle? Even if via |
Beta Was this translation helpful? Give feedback.
-
that's a design/docs oversight, open an issue to discuss it there |
Beta Was this translation helpful? Give feedback.
-
Thank you so much @AlexanderTerp! Here are the answers:
|
Beta Was this translation helpful? Give feedback.
-
First of all, really cool project! I've gotten really into writing useful bash scripts in the past year and as I've been getting into more advanced/complex things, I've found myself wishing for an alternative, and Amber is looking really promising!
I've been playing around with it and reading the onboarding docs a bit. I had the following questions/suggestions:
Q: Is there a reason to use
exit
fromstd
overfail
? It appears to me like you can usefail
withunsafe
if you wanted to replicateexit
-like behavior. I guess the difference is that withexit
, you keep the 'failure-scenario' internal to the function, rather than advertise the fail-ability of it. I can't think of a reason right now for when I'd want that, but I suppose it might exist?Q: What is the purpose of needing
main
in order to allowfail
/?
syntax? Could we not implicitly surround the entire run script in amain
, removing the need to wrap your code and indent it (styling)? There's probably some language design/philisophy I'm not familiar with since it's not necessarily unique to Amber, but my initial impression is that it seems like an extra bit of unnecessary cruft to writing scripts.Suggestion: when I got to the
basic_syntax/commands
(and the linkedbasic_syntax/functions
) sections of the doc, I was confused about why myfail
/?
attempts were failing to compile (withFail statements can only be used inside of functions or the main block
). By this point, the docs had not yet mentioned (to my memory) what amain block
was, or that it was necessary (keep in mind I'm in a bash headspace when trying out Amber so it didn't click for me). Only untilbasic_syntax/importing
does the main block get mentioned/explained. I'd recommend mentioning that earlier in the docs, since it seems like basic pre-requisite knowledge to understandingfail
/?
:)4. Suggestion/discussion: I've seen some discussion of this online as well on Amber, and I think I lean towards splittingJust saw issue 70, ignore!Num
intoInt
andFloat
making sense. In most cases, my scripts are only gonna be dealing withInt
s, so the compiled bash paying the cost of needing to handle floating points feels a bit wasteful. Idk if you guys have plans/ideas for how to optimize this away while keeping theNum
type, but interested to hear where people's thinking is on this :)Thanks again for your work on Amber, really exciting project, best of luck with it!
Beta Was this translation helpful? Give feedback.
All reactions