Skip to main content

Data Types

iXML is a loosely typed language where the data type of a variable is often determined by the context in which it is used. However, the underlying runtime recognizes distinct intrinsic data types, and understanding them is essential for avoiding common bugs.

Type system overview

XML does not know intrinsic data types — in iXML, textual content is string by default unless converted by context or explicit cast. This is one of the most important facts for new iXML developers:

XML
<set var="x">42</set> <!-- "42" is a string -->
<cast var="x" type="int" /> <!-- now 42 is an integer -->

The <set> command always produces a string. If your logic depends on numeric or boolean behavior, you must cast explicitly with cast or rely on automatic evaluation in contexts that expect a specific type (like int attributes).

Available types

iXML recognizes nine types, divided into primitive (assigned by value) and complex (assigned by reference):

TypeCategoryNeutral LiteralDescription
nullPrimitiveNULLAbsence of a meaningful value
boolPrimitiveFALSETruth value (TRUE or FALSE)
intPrimitive0Whole number without fractional part
floatPrimitive0.0Number with fractional part
stringPrimitive'' (empty)Byte sequence or Unicode characters
arrayComplexOrdered key-value collection
functionComplexClosed subroutine with local context
macroComplexOpen subroutine in caller's context
classComplexArray prototype for OOP

Use typeof to inspect a variable's type at runtime:

XML
<set var="x">42</set>
<typeof var="x" var_result="t" />
<output>$t</output>
<!-- string -->

Detailed type guides

  • Strings — the default type, string operations, and encoding
  • Numbers — integers, floats, arithmetic context, and notation
  • Booleans — truth values, truthiness rules, and comparison behavior
  • Null and Undefined — the difference between null, undefined, and empty
  • Arrays — ordered key-value collections, the primary complex type
  • Type Conversion — casting rules, comparison behavior, and the conversion table