A Variantis a union of all built-in data types including an ExtensionObject. Variantscan also contain arrays of any of these built-in types. Variantsare used to store any value or parameter with a data type of BaseDataType or one of its subtypes.
Variantscan be empty. An empty Variantis described as having a null value and should be treated like a null column in a SQL database. A null value in a Variantmay not be the same as a null value for data types that support nulls such as Strings. Some DevelopmentPlatforms may not be able to preserve the distinction between a null for a DataTypeand a null for a Variant, therefore, applications shall not rely on this distinction. This requirement also means that if an Attributesupports the writing of a null value it shall also support writing of an empty Variant and vice versa.
Valuesof Attributesare always returned in instances of DataValues. Therefore, the DataTypeof an Attributecannot be a DataValue. Variantscan contain DataValuewhen used in other contexts such as Method Argumentsor PubSub Messages. The Variantin a DataValuecannot, directly or indirectly, contain another DataValue.
ExtensionObjects and Variantsallow unlimited nesting which could result in stack overflow errors even if the message size is less than the maximum allowed. Decoders shall support at least 100 nesting levels. Decoders shall report an error if the number of nesting levels exceeds what it supports.