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
local -i
not supported
#864
Comments
Thanks for trying it! Do you know if the As far as I know that's the only place where the
I would say the canonical way to do it is like this:
With the This is technically documented here, although I could probably expand on the Basically Oil behaves like Python and JS with respect to types. Bash barely has types (there is so much auto-conversion), and most people don't know how to use them, so osh does something a little more familiar. |
And if there are a ton of scripts using this, I'd be interested in how many ... it should be a fairly greppable pattern, e.g. something like
although maybe you also include declare, readonly, etc.
|
There are two places where it's being used in nixpkgs directly:
However, if osh is being used as a bash replacement, we might also encounter this issue in any of the 40k+ packages being built with it. Is it not part of the goal of the project to get to 100% compatibility with bash? |
Reading the docs, it looks like osh is already making the |
Hm I found that the This actually goes back over 3 years to issue #26 ! That's when I added Answers:
Looking at the code, here are some patches that could be applied:
The latter looks cleaner to me anyway ... I understand if people don't want to do the work to migrate to OSH. But my goal right now is to add so many other compelling features to OSH that you will want to do this work :) If there were a ton of other scripts that use Also since you mentioned you were interested in strictness, I would view these patches as making your script more strict. The Even if we implemented |
Thanks a lot for the detailed explanation and for sharing all that context with me. I can see much better where you are coming from now. As a Bash user, I thought that the intent of Do you think using For now, I will remove the instances of it in nixpkgs. I want to run osh of the packages and am curious to find out how many will break (and hopefully find more compatibility issues). |
Using
But really Oil already provides such asserts with No error checks from bash:
Compatibility, but error checks with Oil:
[1] http://www.oilshell.org/release/latest/doc/oil-options.html |
So basically I would view this as an instance where the
Similar to what happeneed with mal Lisp: https://www.oilshell.org/blog/2020/06/release-0.8.pre6.html#patch-to-run-the-mal-lisp Example of parse time errors:
(the error message could be improved, but at least it's there) |
Thanks for trying Oil! I'm closing this now but please let me know what other issues you run into I am adding things to Oil so this kind of work will be worth it, including rich tracing ( |
this one is a little more controversial see oilshell/oil#864 for more information
this one is a little more controversial see oilshell/oil#864 for more information
I was playing with replacing bash with osh nixpkgs: NixOS/nixpkgs#105233 and found this compatibility issue.
Bash:
Osh:
Tested with Osh v0.8.4 and 0.8.5
The text was updated successfully, but these errors were encountered: