Why Sponsor Oils? | blog | oilshell.org
This is the latest version of Oil, a Unix shell that's our upgrade path from bash:
Oil version 0.8.12 - Source tarballs and documentation.
To build and run it, follow the instructions in INSTALL.txt. The wiki has tips on How To Test OSH.
If you're new to the project, see Why Create a New Shell? and posts tagged #FAQ.
I announced version 0.8.9 about three months ago, and then skipped 0.8.10 and 0.8.11 for lack of time. Instead, I informally kept track of changes in Zulip threads, as well as on Github. Here's a summary:
Oil 0.8.10 Released (Zulip).
Notes for Oil 0.8.11 (Zulip). Many OSH and Oil language changes!
shopt --set sigpipe_status_ok
, instead of run --status-ok
.push-registers
builtin, to "reify" global shell state. Code that
uses eval
can avoid clobbering global "registers" like $BASH_REMATCH
.
Relevant to the headless shell and programs like ble.sh.setlocal
and set
setref
properlyread :x
only mutates locals in Oil mode. That is, it doesn't use dynamic
scopeshopt --set parse_backslash
strict_errexit
(many thanks for Raphael Megzari for trying
Oil and reporting these two issues)strict_errexit
Notes for Oil 0.9.0 (Zulip). (I decided to release 0.8.12 before 0.9.0.) I mentioned this thread in the intro to Recent Progress on the Oil Language. That post gives more color on the motivation for these changes.
c'\n'
. We just use bash's
$'\n'
syntax. It's a little "warty", but I don't want to introduce more
complexity.r
prefix in command mode, e.g. r'C:\Program Files\'
. This
makes it consistent with expression mode.'''
and """
and $'''
. I
really like this change because it simplifies the language and subsumes here
docs. I need to write a blog post about it.
obj.field
syntax, but keep obj.method()
.
mydict->key
instead of fields. But we still want
s.startswith('prefix')
, since both Python and JavaScript have it._ append(mylist, 'foo')
. (The _
is a keyword that puts you in expression
mode.)push
builtin was renamed to append
to be consistent with the
append()
method/function. The builtin is syntactic sugar that works on
arrays of strings rather than typed data.module
builtin that allows an "include guard" pattern: module foo || return 0
runproc
builtin, similar to the command
and builtin
builtins. It
affects first word lookup.shvar
builtin to manage dynamically scoped variables like IFS
,
_DIALECT
, _ESCAPE
, etc. Remember that assignments in Oil procs don't use
dynamic scope by default.use dialect X
, the start of several mechanisms for DSLs in
shell. For example, I want to generate
Ninja with use dialect ninja
.
Not mentioned elsewhere:
run
builtin was renamed to try
. And try --assign :status
is now the idiom
for handling exit codes, rather than failing on non-zero._
in number literals like 1_000_000
.bin/oven
, a sandboxed variant of the interpreter for
config file evaluation.$'\n'
. I
don't have a problem with these decisions, but I document them in case
anyone wants to get involved — and come up with creative solutions!
(Most languages have warts, but they don't tell you what they are!)var
and const
.lobste.rs
thread for motivating this. The first step is simply running your
unmodified shell script with OSH. Let me know what happens!I summarized most of these issues above, but here is a raw list.
Thanks to Travis Everett for running OSH and reporting the crash with
${!undef-}
: bash indirect expansion combined with the -
operator. The fix
for this was pleasant due to Oil's use of algebraic data types!
Apologies if I've accidentally omitted anyone else's contributions.
#956 | crash with eval ${!undef-} |
#952 | shvar builtin to set name=string options, with stack discipline |
#949 | Rename a couple builtins |
#940 | Remaining String Literal Issues (syntax and semantics) |
#932 | strict_errexit too strict with allow_command_sub |
#931 | parse_backslash should allow escaping space |
#919 | run --status-ok SIGPIPE works with /usr/bin/printf but not builtin printf |
#897 | maybe get rid of set and/or setlocal for now? setvar is OK? |
#888 | document const semantics |
#849 | parse_triple_quoted: modern here doc syntax (and multiline strings) |
#716 | Oil could disable dynamic scope and provide explicit syntax to opt-in |
#586 | Implement setref |
Here are the commits from other contributors. You can also view the full changelog.
6b92b97b | Raphael Megzari | [doc] Add an executable file that will becom A Tour of Oil (#935) |
$_this_dir
, since it falls under
#real-problems.bin/oil
!I'm also taking stock of the Oil language and documenting it. This Zulip thread might be interesting to those closely following the project: Oil Syntax: What's Left?
These metrics help me keep track of the project. Let's compare this release with version 0.8.8, which I announced in March.
OSH spec tests made slight progress:
Oil spec tests made more:
We have ~600 new significant lines of code:
And ~1500 new lines of physical code:
Let's compare against version 0.8.9, where we introduced the stable cachegrind benchmarks.
I have a hard time interpreting this! The cachegrind benchmark is supposed to
stable, so we're apparently we are doing more work per line, which is bad. But
the noisy benchmarks show an improvement, though this may be an illusion. I
don't recall anything that would have caused this, except maybe
new parsing options like shopt --set parse_backslash
.
I'll continue to keep track of this over time. It's good to have more measurements.
Runtime:
configure
configure
This variation is within benchmark noise. Note the machine changed from lisa
to lenny
(because I moved an upgraded my machine and OS). This is reflected
in the provenance sections Shell and Host Details.
Translation has stalled, but at least it's not regressing. I want to solicit help with this.
The lines of native code increased, probably due to bin/oven
:
The binary size increased a bit:
Note: After the lisa
-> lenny
upgrade, the 2 benchmark machines are using
different versions of Ubuntu, which means different compilers, which produces
binaries of different size. I used the common machine flanders
for this
comparison, but it will change over time.