Skip to content
andychu edited this page Jul 21, 2021 · 13 revisions

This is an initial cut of FAQ based on questions from lobste.rs.

See also: https://www.oilshell.org/release/latest/doc/oil-language-faq.html (needs editing)

Design of the Syntax

Why is there an explicit setvar keyword?

Oil has both expression mode and command mode, and it's consistent if we say that expressions are introduced to the right of var, const, and setvar. It's also "huffman coded" as mutation with setvar is less common than const, IMO.

Note that a bare x = 42 does work for config files in Oil, but that requires shopt --set parse_equals. We want something that does not change between oil:basic and oil:all. That is, we want two languages (OSH and Oil), not three!

In shell/OSH you can do x=mystr (no spaces); in Oil it's setvar x = 'mystr' (quotes required).

Clone this wiki locally