Skip to content
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

Oil Blocks #631

Closed
1 task done
andychu opened this issue Mar 7, 2020 · 5 comments
Closed
1 task done

Oil Blocks #631

andychu opened this issue Mar 7, 2020 · 5 comments

Comments

@andychu
Copy link
Contributor

andychu commented Mar 7, 2020

cd already takes a block:

cd /tmp {
  echo $PWD
}
echo $PWD

Other features it could / will support:

high priority:

other:

  • config files that evaluate to JSON -- need stack name_map -> value.AssocArray
  • find alternative (fs or verb walk)
  • awk like BEGIN, END, when (wok)
  • punted to users: make-like blocks with rule
  • much later: lex/yacc dialects with eggex patterns

  • shopt -- pretty important. Would be nice to refactor errexit first, so we have a stack of flat arrays.

(You could argue if this is "essential", but it carries so much weight that I think it has to be. A lot of it won't make it but some of it should.)

@andychu
Copy link
Contributor Author

andychu commented Oct 10, 2020

Note, we now have block literals in expression mode like &(echo $PWD)

What else do we need

  • shopt needs to take a block (requires refactoring of errexit stack)
  • we need some kind of evalexpr() or evalblock() function . User should be able to control the namespace

@andychu
Copy link
Contributor Author

andychu commented Feb 3, 2021

We need an evaluator with a controlled "first word lookup". Related to #588 first word lookup

User feedback includes use and parse-opts.

  • argparse blocks contain flag and arg
  • use lib blocks contain use proc

Other:

  • They also must turn off globs! Should you just do shopt --set noglob temporarily?
  • proc-main for context manager style context manager style for cleanup / trap handlers #861/
  • fs . { name '*.py' } is like find . -name '*.py' . So it needs predicates like name and type.
    • it turns OFF errexit
    • maybe it should also turn off globbing so we don't have to quote?

@andychu
Copy link
Contributor Author

andychu commented May 21, 2021

First class blocks don't have a new scope by default:

89bff41

BUT I think evalblock() can push a new temp scope.

@andychu
Copy link
Contributor Author

andychu commented Nov 28, 2021

Already done:

  • shopt
  • cd
  • fork
  • forkwait

Near term list:

  • eval
  • argparse
  • describe?

It doesn't feel like we need blocks for use. #453

Longer term:

  • BEGIN, END, when (awk)
  • each (xargs)
  • fs (find)
  • anything like make (rule)

@andychu
Copy link
Contributor Author

andychu commented May 21, 2022

All the eval_block() / eval_to_dict() stuff is now in #951

And builtins are in issues like #863

@andychu andychu closed this as completed May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant