Why Sponsor Oils? | source | all docs for version 0.29.0 | all versions | oils.pub
Here are all types of values in the Oils runtime, organized for understanding.
Values of these types are immutable:
Null BoolInt FloatStr
Eggex Match - to match patternsRange - to iterate over 3 .. 5Stdin - to iterate over lines (has a singleton value)List Dict - YSH containers are arbitrarily recursivePlace is for "out parmas"
&myvar, mutated with call place->setValue(42)BashArray BashAssoc are for bash compatibility in OSH:Obj 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 instances with attributes, and an __invoke__ method.Obj instances with an __index__ 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 FuncBuiltinProc ProcCommand Expr - custom evaluation of commands and expressions Frame - a frame on the call stack (proc and func)DebugFrame - to trace eval() calls, and moreThese types can be serialized to and from JSON:
Null Str Int Float List DictIn 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]