Expand description
The value a Lua member takes when the stream does not carry it.
Table 9 of DDS-XTypes 1.3, as Lua. crate::default_python is the
same table as Python and carries the clause quotations; this is a
further derivation and deliberately not a call into any sibling —
the columns are compared against each other, and a shared helper
would make them agree about a mistake.
§The Lua spellings, where they differ from every sibling
An aggregate is a table constructor, not a call. A Lua table
needs no class and no constructor: { x = 0, y = 0.0 } is the
value, member defaults nested inside. A nested aggregate member is
still a call — ZD.zd_def_Inner() — so one type has one answer and
two positions cannot drift.
An @optional member is a key left out. §7.2.2.4.4.4.8’s
“Implementations shall not provide a default value” is the absence,
and in Lua the absence of a value is the absence of the key; a
constructor entry holding nil would not even create one.
A char and a wchar are the code point, as an integer. The
member holds an integer — adapter/lua.rs’s mapping — so Table 9’s
zero is 0, not a one-character string.
A long double is the decimal text "0.0". A Lua float is a
binary64; the member holds text and runtime/lua converts exactly.
"0.0" and not "0", because it is also what
float128.bits_to_decimal answers for the zero pattern, and one
value should have one spelling on both directions.
An enumeration’s default is read out of the descriptor.
M.a.b.Colour.values.RED — the materialiser’s own table, through
CodecTarget::enumerator_constant, so the file that declared the
value is the file this reads it from.
A fixed array is that many entries, spelled out. A Lua table
constructor evaluates each entry, so { ZD.zd_def_T(), ZD.zd_def_T() }
is two distinct tables — there is no [x] * n aliasing trap to
avoid, and the spelled-out form is simply the only form.
Functions§
- default_
into place = ZD.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 like
crate::emit::decode::decoder_name, by the IDL kind for a primitive: ten of the fifteen are one Luaintegerand a name built from the holder would give them one defaulter. - lua_
defaulters_ called_ by - The defaulters
declscall, and exactly those, read off the emitted calls rather than derived a second time from the model — the same closure disciplinedefault_pythonanddefault_cstate at length. - lua_
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.