Warning: Work in progress! Leave feedback on Zulip or Github if you'd like this doc to be updated.

Oils Pure Mode: For Config Files and Functions

The interpreter can run in pure mode

Table of Contents
Why does Oils have Pure Mode?
WebAssembly Analogy
When is it active?
--eval-pure
eval() and evalExpr()
Pure Functions
What's allowed in Pure Mode? Not allowed?
Notes

Why does Oils have Pure Mode?


WebAssembly Analogy

WebAssembly is also pure computation, and can be used in a variety of contexts.

It has io too.

When is it active?

--eval-pure

vs --eval

TODO: link to doc/reef

eval() and evalExpr()

vs. io->eval() and io->evalExpr()

TODO: link to doc/reef

Pure Functions

What's allowed in Pure Mode? Not allowed?

What's not allowed:


Notes

Pure mode is a bit like functional programming, but the style inside a function is not functional.

In YSH, it's natural to write pure functions in an imperative style. Just like you can do this in Python or JavaScript (although there is no enforcement, unlike Oils)

Generated on Wed, 25 Jun 2025 16:06:10 +0000