Why Sponsor Oils? | source | all docs for version 0.24.0 | all versions | oilshell.org
Here are all types of values in the Oils runtime, organized for understanding.
Values of these types are immutable:
Null
Str Int Float
- data typesRange
- iteration over 3 .. 5
Eggex Match
- pattern matchingA type with one value:
Stdin
- used for buffered line I/O in the YSH for
loopThe Str
type is the only type shared between OSH and YSH.
YSH containers:
List Dict
- arbitrarily recursiveA special YSH type for "out params":
Place
- created by &myvar
, and mutated by call place->setValue(42)
Containers for bash compatibility in OSH:
BashArray BashAssoc
- flatObj
is for User-defined TypesObj
- has a prototype chainObjects allow polymorphism. See YSH Objects.
Modules and types are represented by Obj
instances of a certain shape, not by
primitive types.
Obj
with attributes, and an __invoke__
method.Obj
with a __str__
method, and are often compared for
identity.In general, Objects are mutable. Do not mutate modules or types!
Values of these types are immutable:
BoundFunc
(for methods)BuiltinFunc Func
BuiltinProc Proc
Values of these types are immutable:
CommandFrag Command
Expr
(no ExprFrag
for now)A handle to a stack frame:
Frame
- implicitly mutable, by setvar
, etc.These types can be serialized to and from JSON:
Null Str Int Float List Dict
In YSH, the Obj
type is used for polymorphism and reflection.
Polymorphism is when you hide different kinds of data behind the same interface.
But most shell scripts deal with concrete textual data, which may be JSON-like or TSV-like. The data is not hidden or encapsulated, and shouldn't be.
These types used internally:
value.Undef
- used when looking up a variablevalue.Interrupted
- for SIGINTvalue.Slice
- for a[1:2]