Skip to content
andychu edited this page Jan 19, 2017 · 39 revisions

High level Goals

Design a modern Unix shell that can do everything bash/zsh/etc. can do, and more:

  • System Administration
    • Building Linux distributions (e.g. Arch Linux uses bash for PKGBUILD).
    • Startup scripts
    • Configure and build scripts. Reproducible and distributed builds.
  • Distributed Computing
    • Building containers
    • specifying remote jobs
    • Feedback and Monitoring: performance measurement, security testing.
  • Scientific Computing
    • Heterogeneous "big data" and small data pipelines. The language should scale down as well as scale up, i.e. low startup latency for small jobs.
    • Incorporate features of "workflow languages" and systems in the MapReduce family.
    • Reproducible Research.
  • Interactive Computing
    • a general purpose REPL (terminal and probably a Jupyter kernel).
  • Document Publishing
    • http://oilshell.org/ and many programming books are built and orchestrated with shell scripts / Makefiles

Oil Language Design Goals

  • Easy upgrade path from bash, the most popular shell in the world.
    • To do this, I've written a very compatible bash parser, which will allow automatic conversion of bash (osh) to oil. So the language has a different syntax and a superset of bash semantics.
  • Consistent syntax.
  • Improve and fix semantics (in a backward compatible way).
    • Proper Arrays
    • Strict mode for developer productivity (enhanced set -o errexit, nounset, pipefail)
  • Treat the shell as a real programming language.
    • Example: Completion functions in bash have a bad API involving globals and are difficult to write. It should feel more like writing completion functions in Python or JavaScript.
    • Fill in obvious gaps, like abspath, etc.
    • Selected influences: Python, R, Ruby, Perl 6, Lua (API), ML, C and C++. Power Shell.
  • Reduce language cacophony in shell programming.
    • Example: combine shell, awk, and make.
    • Also combine tools like find (which has its own expression parser and starts processes), and xargs/GNU parallel, which both start processes. GNU parallel is actually mentioned in the bash manual.
  • Richer constructs for concurrency parallelism
    • Folding in make -j and xargs -P goes a long way.
  • Allow secure programs to be written.
    • In emitting strings: escaping
    • In reading strings: error checking should be easy, better control over "read" delimiters, etc.
    • Fix issues with globs and flags, i.e. untrusted file system and untrusted variables

Implementation Goals

  • Proper error messages like Clang/Swift. Static Parsing.
  • Provide end-to-end tracing and profiling tools (e.g. for pipelines that run for hours)
  • Library-based design like LLVM. Example: the same parser is used in batch mode as well as completion mode, which is not true of all shell implementations. The parser can be used for auto-formatting and linting, which is also not true of other implementations.
  • Few dependencies so it can be used in bootstrapping Unix systems and clusters. (e.g. distributed as a C++ file and optional oil source.)

Longer Term Goals

  • Expose our toolkit for little languages -- lexing, parsing, AST representation, etc. So that other languages can be built in the same way.
  • Metaprogramming with ASTs as first class data structures.
Clone this wiki locally