-
Notifications
You must be signed in to change notification settings - Fork 92
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
A builtin returning the Bash version as a Num
#622
Comments
Thanks for creating this issue. I would have got round to it eventually! |
I think it should expose the fix version as well as the major and the minor. |
I'm running Bash 5.2.21.1; the Amber function I wrote to bypass negative array index validity tests returns
If we're going to include all four numeric components, extending this to Can I suggest that we consider returning an array, and implementing version comparison, at least for
|
I have not known the fourth one! Well, how about supporting |
Or string as argument and supporting all the following, etc?
|
Having functions
|
Also,
I'm not saying
|
tbh, I am hesitating because I think array comparison has not the standard definition and is not a common binary operator in programming. If string is not acceptable, how about the former, |
On the contrary, lexicographic ordering is implemented for lists in Python and arrays in Ruby. It's also implemented for strings (treated as lists of characters) in every language I can think of, which is why it's called "lexicographic ordering" in the first place. I'd say this is the behaviour most programmers would expect.
I still favour direct array comparison, but if we do decide on a standard library based solution, it would make more sense to implement a greater than or equal comparison, to implement functionality based on minimum supported Bash version. I'd also want a less cumbersome function name. |
I agree.
Thank you for pointing out. I never know that, and I did not use that before. Then I am okay. Just to clarify:
Are the two things right? |
Array comparison would have to be written in Rust. The Bash version could be generated by a standard library function:
Obviously, this would become a lot nicer if we implement #623. |
Originally posted by @hdwalters in #620 (comment)
Originally posted by @hdwalters in #616 (comment)
The text was updated successfully, but these errors were encountered: