Expand description
The value an Elixir member takes when the stream does not carry it.
Table 9 of DDS-XTypes 1.3, as Elixir. crate::default_python is
the same table as Python and carries the clause quotations;
deliberately a further derivation and not a call into any sibling,
because the columns are compared against each other and a shared
helper would make them agree about a mistake.
§The shape
One zero-arity function per type — zd_def_T() -> value — because a
literal cannot be trusted to appear identically at every position a
member can go missing, and because the decoder’s own shape wants it:
emit/elixir.rs’s reader opens with v = zd_def_T(), so every
position the stream does not carry is already what Table 9 says
before an octet is read.
§What the Elixir mapping decides
- An aggregate is a struct literal:
%Common.Pose{x: 0, y: 0.0}, every non-optional field written. An@optionalmember is left out — thedefstructdefault is alreadynil, and §7.2.2.4.4.4.8’s “Implementations shall not provide a default value” is that absence. - An enumeration’s default is its constant function:
Common.Mode.idle(), which answers the declared integer — the binding holds enumerations as integers, and the function is the materialiser’s own spelling, so a moved@valuemoves both sides. - A
charis"\0"— a one-character binary, because the member holds one and an integer there would be a different type. - A
long doubleisZeroddsWire.Float128.zero()— sixteen octets, never afloat(), which holds 53 of its 113 significand bits. - A
fixed<P,S>is the one decimal spelling of zero for its scale —"0.00"forfixed<5,2>;""is not a decimal. - A collection is
[]and an array is its elements spelled out as a tuple, one defaulter call per element — the{T, …}the materialiser declares, which a list is not==to.List.duplicate(zd_def_T(), n)would evaluate the element once, which for an immutable value is harmless — and is still not written, because the sibling columns spell the elements out and a reader comparing generated files should not have to know which columns may share.
Functions§
- default_
into place = zd_def_T().- defaulter_
from_ decoder - The defaulter that goes with a decoder, by name — the two schemes differ in one word because both are built from the same key.
- defaulter_
name - The defaulter function name for a type, keyed the same way
crate::emit::decode::decoder_nameis. - elixir_
defaulters_ called_ by - The defaulters
declscall, and exactly those — read off the emitted calls rather than derived a second time from the model, for the reasoncrate::default_python::python_defaulters_called_bygives at length. - elixir_
defaulters_ over - Build the defaulter for each of
types, once per name. - member_
default - One member’s default: its
@default, or its type’s. §7.2.2.4.4.4.9 puts the explicit one first.