Basic Types in MxL

The type-system of MxL consists of the following types:

Name Super type Description and Notes
Object - Each element of the data model is of type Object
String Object Each character sequence encapsulated in quotation marks is a value of type, e.g. "hello world"
Number Object Represents both integers and decimals, e.g. 123.456
Boolean Object true and false
Date Object A date consisting of day, month, and year. Can be constructed by the date-function and the date’s string representation. The current date can be determined by the global identifier Today. The components of a date are accessible via day (e.g., month (e.g. Today.month), and year (e.g. Today.year).
Map Object A dynamic collection of key-value-pairs. The constructor is written as [k1: v1, k2: v2, ...] (e.g., ["a": 1, "b": 2]) while single elements of the map can be accessed via the respective element’s key and the [] operator, e.g. any-map["a"].
This type can be parameterized to determine its key and value types, e.g., the type Map<String, Number> describes a map with String keys and Number values.
Structure Object A complex object having an arbitrary number of attributes. The constuctor notation is similar to the JavaScript Object Notation (JSON), e.g. {number: 1, title: "hello world"}. The expression {any-identifier} is a short-cut for {any-identifier: any-identifier}.
The Sequence-type can be parameterized to determine its inner structure, e.g., the type Structure<name:String, x:Number> describes a complex object which has an attribute name of type String as well as an attribute x of type Number.
Entity Structure The type entity is the base type for all user-defined entity types (e.g., Project, Customer, etc.) An entity is represented as a complex object, i.e. an object with attributes and/or references to other objects.
Sequence Object A sequence of values, written as [element1, element2, ...]. In contrast to the mathematical term “set”, in sequences order matters and duplicates are allowed.
The Sequence-type can be parameterized to determine the type of the sequence’s element, e.g. the type Sequence<Number> defines a sequence of numbers. The elements of a sequence are accessible via [ ] and the element’s index, whereas the index is zero-based.
Function Object Because the language allows higher-order functions, there are objects of type Function. Anonymous functions can be written as (param1, param2, ...) => any expression.
This type can be parameterized to determine the function’s signature (parameter types and return type), e.g. the type Function<Number,Number,Boolean> defines a function having two parameters of type Number and returning an object of type Boolean. Moreover, parameter types can be defined as optional by a question mark (the function can be invoked without optional parameters), e.g. Function<Number, Number?, Boolean> can be invoked for either one or two parameters.
Type Object A meta-type objects representing types.

The following picture shows an overview of all basic types of MxL in form of an UML class diagram:

Overview over basic types of MxL