[Type] Dynamic

Part of: mobl
Inherits from: mobl::Object

Represents dynamically typed values. Mobl is a statically typed language. However, in some cases it can be useful to be able to call random methods on objects and access random properties.

Values of type Dynamic can be assigned to variables and properties of any type. Any type of value can be assigned to a variable or property of type Dynamic.

A new Dynamic variable can be created using simple assignment:


var d : Dynamic = "Hello";
d.whatever() // -> no compile-time error
d.something = 8; // -> no compile-time error

Syntactic sugar

The type Dynamic, can also be written as ?:


var d : ? = "Hello";
mobl/dynamic.txt · Last modified: 2013/10/01 02:28 (external edit)