-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
Configuration Dialect #951
Comments
Config Dialect Use cases -- MOVED TO https://github.com/oilshell/oil/wiki/Config-Dialect |
Naming idea: Just to recap:
idea:
Use cases
|
Idea for
Does |
Instead of |
From Zulip, an idea to make blocks syntactic sugar for dicts, and then gracefully allow more validation with procs: However I'd still like to define the valid first words, so you could have
And then 'package' and 'user' could be ways to define dicts, like
would turn into
|
New minimal idea (in NOTES.txt)
Is that it? Issue for later:
|
Evaluation rules:
|
So that shvar PATH='' { ... } can be used to make all binaries invisible. This mechanism is for config files #951. [doc] Plan out more of Oil as well. QTT builtins.
Add tests for push-registers builtin. This is another mechanism for config file #951.
Part of the config dialect #951. It's statically typed, but doesn't run yet. [doc] Oil vs Python updates
More isolation issues:
Doh so we need to restrict the builtins dictionary ... Or we can rely on containers to do this? It is an argument for always forking a process ... But then how do we get procs from one place to the other? I think we don't want
It's a bit more complicated that way but probably more general and secure ... we don't want a blacklisting approach; whitelisting is better. Although |
Although
|
This is reflection of Oil in Oil! For #951. We set all Oil parse options as well as parse_equals, and then invoke the CommandParser. TODO: Still need to close files in fd_state. And shopt --set pure_oil can check that.
First cut of More:
Related issues
|
|
A big part of #951. We are printing code blocks and have location info. Still need to write an end-to-end demo, and possibly modify the rules for '=' inside blocks.
It's no longer an Oil / Hay distinction. This is good because it reduces parser parameters/state! It's also good because we disallow 'x = 42' in most places in Oil. We don't parse it as the command 'x' with arg '='. And move shopt --set parse_equals to the oil:upgrade group, because bare '=' shouldn't be common. Part of #951. Related to previous parse_equals changes in this release.
More:
After some usage and feedback:
|
- Within 'hay eval' and eval_hay(): basic sandboxing. - You can call procs, hay nodes, or echo/write/use. - At the top level: there is no sandboxing. - You can get the result with _hay() - Maybe this goes within proc _main later? The non-sandboxed kind should be useful for associating metadata with procs? But I guess you can't use eval_hay() on it, because that's also sandboxed. Might need to tweak these rules. This is part of #951.
Had a look into the new doc/hay skeleton, and as you have mentioned DSLs there, and I still had your comment about the common push / pop issue in mind (#1059 (comment)), I felt maybe there is some common solution there to find. Ruby/crystal seems to have two types of blocks for DSLs:
Maybe some kind of general apply/with/to/do or and? -block might help for DSLs, too? |
Yeah there is definitely possibility of things like that ... though I want people to use it first, and actually hit the problem, before we add complexity! I'm pretty happy with the simple first pass, and hopefully we'll get a bunch of feedback on it This feature is a bit more obscure than others, because I think platforms / maintainers will generally use it, not end users. i.e. it's for people building something like sourcehut, Github Actions, systemd, podman/Docker, etc. |
Sure, a universal/left/right block application idea/rules will likely need some time to ripe anyway. I had thought hay could be nice even just for exposing simplest config files to users, thanks to the sandboxing, safe to "source", no need to write parsing code? But I didn't grasp the whole usage/practical picture just yet. |
Something in your latest "Sketches of YSH Features" blog and your intention for ysh to be well-extensible by users, made me remember my comments here. You wrote:
This sounds as if it wouldn't allow to pass multiple blocks. I'm not sure if that would still allow for exposing/allowing for more generic block usage, i.e. having left and right binding blocks (for better readable DSLs #951 (comment)), as well as making use of hay-based config in ysh itself (e.g. no fuzz readable redirection syntax #1059 (comment)), and generic apply {...} to {...} block application or "operators". With code+data in the blocks (i.e. hay) could that maybe be a useful basis to allow for implementing, e.g. said matrix algebra operators etc., as extensions as ysh libraries instead of compiled code? |
I think you can only pass on block in the But there's nothing stopping you from passing multiple blocks the expression style, like
It's mainly a syntactic limitation But yeah when we implement that, we should have some test cases for it |
Summary: YAML alternative / COWS: configuration in Oil without Side effects
This is part of #631: Oil Blocks
Rough sketch of what we need:
evalblock()
functionPushTemp()
andPopTemp()
?blockstring()
function? I noticed this need for source/hut travis inline shellshopt --set dynamic_scope
?shopt --set parse_equals
-- this is NO LONGER a synonym for constsetvar
without a correspondingvar
??? Inside a block.Example of evalblock
How does scope work?
The text was updated successfully, but these errors were encountered: