-
-
Notifications
You must be signed in to change notification settings - Fork 159
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
procs could be tagged oil:all ? #1147
Comments
Really we need to try porting our own shell scripts with this mechanism ... |
I think this is a pretty good idea. It will allow opting into Oil without even thinking about options -- just write new It also has the property of LOCAL REASONING You can tell how your function behaves without looking at the top of the file!
Recommended file extensions
|
@bar-g might want to give feedback because it affects the usage table Idea
This came up because of Configuration blocks (hay blocks) are run with Oil. |
Really a pretty nice idea to try out (maybe option oil_in_proc?) it could only enable oil:upgrade, to break as few things as possible. I think it would be important to be able to use shell functions (as defined elswhere or in a lib), it seems pretty moot otherwise, wouldn't it? Maybe a file extension |
Would this be avoidable by explicitly setting |
So the idea behind disallowing shell functions is forcing syntax to match semantics and local reasoning according to the Language Design Principles If you run into that error
Then you're supposed to change the code, and it will be more readable. Right now you have two questions:
You cannot answer this question without looking at the top of the file or tracing the program. This bug proposes:
Then you have the remaining question:
I don't want the answer to be:
It's better if when you call
|
It's will be slower to set options on every proc call than to set it once at the top level. But it might not be that slow, and if it is, we can find a way to optimize it. We should get the language behavior right first :) |
Looks like if it works as pictured, it could really be a candidate to be enabled by default. |
Yeah I think this can work and will be good. Only issue is that you will still need I think that is OK. This came up through "hay" config files #951, but your work on the table made me think of it. Because the table is a little complex. It's totally accurate, but still a little to hard to explain to users. So to simplify the upgrading we just say "use Once you have used So yes everything in the table will still be accurate -- we will have all the same option groups! And yes It's just that when you start writing You don't want to port Oil-looking code to a new Oil! It should just be Oil code, full stop! |
This would break the seamless addition of oil features and propably require to change all functions, even in sourced libs. I don't see an advantage over having to set oil:upgrade globally. Rather the contrary, doesn't that error even worsen selective feature addition? For not much of a practical reason? I see that parsing oil within procs could simplify the selective implentation of new features using oil in existing scripts, and leveraging on the osh-oil compatibility when calling out to legacy shell from there. I'm not sure if it would ever be wanted to disallow non-procs in oil:all, but if yes, than I think that could only belong to oil:all but should not cut into having seamless feature additions and upgrade processes. So may procs only enable oil:upgrade for its environment (only), if running in osh (without any oil:* option)? |
This comment from me was not meant as a confirmation to your (edit: two) message before it, messages crossed again. This is ugly. |
Possibly apply that only to oil:all but not osh and oil:upgrade? And let automatically enabled oil:upgrade within procs be a nice upgrade feature of osh. |
Yes that's still true under this new I guess what I'm saying is we could avoid this situation
So the example is:
BUT I think the answer is:
So on second thought
So let me think about this more... Not sure yet
|
Another issue is that the converse situation also arises: Situation:
So really there is an alternate semantic: functions could be tagged with the options at the time they were defined. OOOF Yeah there is some risk to this. |
So then another option is:
But you still have the call stack problem. If f calls h, then what options is it run with? So yeah I think I will put this off for awhile ... It could be too subtle. But #1148 is a real example of an issue |
As you know I don't have your overview, but to add my two cents: I imagine the migration process to to create errors and each one being a significant step to the migration target (and learning the improved idiom). Idealy, one idiom at a time.
So instead of smoothing the upgrade process, I "fear" having However, if procs where just enabling |
(That is, without any "artificial" errors when calling shell functions, only getting errors wherever something needs to be adjusted to run with oil.) |
Ok, could you still comment/sort out these after the rush. Improved migration experience?:
And simplyfied local oil additions and partial "oil:upgrade"s using proc (triggering oil:upgrade in called code)?:
One problem to solve could be simple word eval, adapting code outside of the proc will need split/glob functions and those may have thus have a reason to stay enabled in osh? |
Hm regarding the last comments, I think we need to get the next release of Oil out (could be 0.11.0) and then start trying the upgrade process ... It's better to change it based on feedback than try to imagine what people will do I have I'd be very interested if you have any scripts you can try it with We can adjust based on feedback; I think we've done enough thinking as it is. The |
This means they implicitly have a
shopt --set oil:all { ... }
around themThis eliminates the problem where the semantics of the function depend on the option state of the caller!
This could be a huge difference between shell functions and Oil procs.
Also it could eliminate the need to think about any options? You just start writing
proc
and it's a new language ???procs
can't call shell functions? That might be OK? You have to do everything from the bottom up ...Similarly,
haynode
blocks run withoil:all
The text was updated successfully, but these errors were encountered: