var.opDispatch

var opDispatch(string name)() ref @safe

Dynamic field access for map values via D's opDispatch.

Mutable overload: routes unknown identifiers to map entries, returning ref var and inserting a default when missing. If the current value is Type.NULL, it is promoted to Type.OBJECT on first write. If the current value is neither NULL nor OBJECT, an assertion fails.

Error messages include the field name being accessed for easier debugging.

Parameters

nameThe field name to access (compile-time string parameter).

Returns

A reference to the value at the given field, creating it if necessary.

See Also

getField for safe access that returns a default instead of asserting.
const(var) opDispatch(string name)() ref const @safe

Const overload of opDispatch for read-only access (no insertion).

Asserts with a descriptive message if:

  • The value is not a map (includes the actual type in the message).
  • The requested key is missing (includes the key name in the message).

Parameters

nameThe field name to access (compile-time string parameter).

Returns

A const reference to the value at the given field.

See Also

getField for safe access that returns a default instead of asserting.