clang::mrdocs::dom::Kind

The type of data in a Value.

Synopsis

Declared in <mrdocs/Dom/Kind.hpp>
enum class Kind : int;


Members

Name Description
Undefined The value is undefined.
Null The value is null.
Boolean The value is a boolean.
Integer The value is an integer.
String The value is a string.
SafeString The value is a safe string.
Array The value is an array.
Object The value is an object.
Function The value is a function.

Description

This is the type of data stored in a Value. These types are loosely modeled after the JavaScript types and data structures.

Primitive values are Undefined, Null, Boolean, Integer, and String.

Undefined and Null are inhabited by a single value each. The difference between Undefined and Null is that Undefined is the default value for a Value, while Null represents a value that is explicitly set. Undefined is used to represent things such as:

This distinction is semantically important as algorithms frequently need to distinguish between these two cases.

Booleans, Integers, and Strings are also primitive values. This means they are deeply copied when assigned or passed as a parameter.

Other value types, such as Array, Object, and Function are reference types, meaning that they are not copied when assigned or passed as a parameter. Instead, the reference is copied, and the original value is shared.

These reference types are modeled after JavaScript "Objects". All non-primitive types (Object types) are derived from Object in JavaScript. This means types such as Array and Function represent a relevant selection of built-in types that would derive from Object in JavaScript.

Objects are a collection of properties, which are equivalent to key-value pairs. Property values can be any type, including other Objects, allowing for the creation of arbitrarily complex data structures.

Created with MrDocs