source |
all docs
for |
all versions |
oilshell.org
Warning: Work in progress! Leave feedback on Zulip or Github if you'd like
this doc to be updated.
The Oil Language from 10,000 Feet
This document describes the Oil language. It also discusses future work.
Related Documents:
Oil Retains These Shell Concepts
- Commands (pipelines, etc.)
- Words
- double quoted
- interpolation
- Variables
- use different assigment builtins
- Shell builtins
- Shell functions, loops, and conditionals
Oil retains them all. A big difference is that keywords rather than builtins
are used for assignment.
Syntactic Concepts
See Syntactic Concepts in Oil
The Word Language Is Enhanced
See Oil Word Language.
Deferred: Static Printf, Formatters
echo ${myfloat %.3f}
Formatters (like template languages)
echo ${myfloat|json}
Special Variables
Special Variables
The Command Language
New Keywords: var
, const
, setvar
var x = 1
auto for autovivification:
auto dict['key'] += 1
maybe const. I want that to be compile-time though.
return
has to be a keyword and not a builtin because it can take arbitrary data types, e.g.
return {name: 'bob', age: 15}
See Oil Keywords.
Shell-Like Builtins
See Oil Builtins.
- Assignment builtins local, declare, export
- Builtins Accept Long Options
Docstrings and Multiline Commands
Note: not implemented.
##
%%%
The Expression Language is Python-Like
The Expression Language Is Mostly Python
See Oil Expressions.
- list, dict literals
- list comprehensions
Builtin Functions
Python and shell both borrow from C. Oil borrows from Python and C.
- len(): str, array, dict
- min, max: int, float
- any, all: truthiness? Are non-empty strings truthy though?
- that's a constraint of 'tea'
- reversed() --- this can be done with
tac
and QSN!
- sorted() ? -- Does QSN have a lexicographical mapping for this?
sum()
- this can be written with a 'wok' filter that runs in process?
- enumerate, zip: these return tuples. Not sure I want to implement them.
Runtime Semantics
Data Structures
- bash-like data structures at first
- fully recursive
Data Types Are Mostly Python?
- "JSON" types in Python: dict, heterogeneous list
- homogeneous string arrays like shell
- homogeneous bool/int/float arrays like R / NumPy
Process Model
Simple Word Evaluation With shopt -s simple_word_eval
Mentioned in the last post. This is big!
Scope and Namespaces
- Like shell and Python, there is a global scope and function scope..
- shell functions don't live in their own scope? This is like Lisp-1 vs
Lisp-2.
- There won't be dynamic scope as in shell.
The use
builtin will provide scope.
Deferred Features
- Coprocesses
- Data Frames from R
- Have to get dict/list/etc. working first
- date and time types
- Low Level Bindings for POSIX, Linux, Containers
- Find Dialect
- replace find
- need work on this
Appendix: Why an Upgrade?
Hejlsberg quote?
Generated on Thu Sep 3 10:28:33 PDT 2020