Language Reference

TODO: This page still needs to be written. Things to include:

  • JsonPath heritage of $
  • Scoping rules of local
  • numbers, floating point rounding error, int64, bitwise on float
  • string unicode stuff, escapes, strings that span lines ||| line endings
  • Precise meaning of $
  • scope of self within an object, including locals, asserts and comprehensions
  • general form of comprehensions
  • general form of slices
  • precise semantics of default argument expressions
  • operator precedence
  • Native callbacks and import callbacks
  • relative paths, jpaths, etc
  • tailstrict
  • recursion in all its forms - functions, objects, modules, locals
  • object orientation, mixins, diamond problem, definition of +:, different kinds of : :: :::
  • laziness

Properties of Jsonnet Inheritance

Let D, E, F range over arbitrary expressions. Let ≡ mean contextual equivalence, i.e if D ≡ E then substituting D for E in any context will manifest to the same JSON.

  • Associativity always holds:
    (D + E) + F   ≡   D + (E + F)
  • Identity always holds:
    D + { }   ≡   D
    { } + D   ≡   D
  • Idempotence holds when D does not contain super:
    D + D ≡ D
  • Commutativity holds when D and E do not contain super and have no common fields:
    D + E   ≡   E + D