TIScript is a dynamically typed language. That means that the variables can contain values of any supported type. Types are:
Integer
The value of the Integer class; a 32-bit signed integer between Integer.MIN and Integer.MAX. If you have definition var i = 3; then following statements are both equal to true: typeof i == #integer; i instanceof Integer;
Float
The value of the Float class; a 63-bit floating point number between Float.MIN and Float.MAX. The following statements both evaluate to true: typeof 3.14 == #float; 3.14 instanceof Float;
String
The value of the String class; an immutable sequence of UNICODE characters. The following statements both evaluate to true: typeof "abc" == #string; "abc" instanceof String;
Symbol
The value of the Symbol class. A symbol (otherwise known as atom) is a unique integer value, assosiated with a name. Internally, symbols are represented by 32-bit integers. Symbols are defined as a name token that's also allowed to have - characters, preceded by the # character. Examples of valid symbols are: #integer, #foo, #Bar, #sub-script. Examples of invalid symbols are: #123, #1abc. Symbols are resolved into unique integer value at compile time. So, the comparison of two symbols is as computationally effective as the comparison of two integers. In TIScript, symbols are used as the names of object attributes. Hence, the expression obj.foo = 1; is a close equivalent of obj[#foo] = 1;. The following two statements both evaluate to true: typeof #abc == #symbol; #abc instanceof Symbol;
Array
An array is an indexed sequence of elements - values. Elements of the array can be accessed by the [index] operator, where index is an integer value - the sequence number of the element in the array. Indexes in arrays start from 0 (zero). If you have a variable defined as var a = [1,2,3];, the following statements all evaluate to true: typeof a == #array; a instanceof Array; a[0] == 1; a.length == 3;
Object
The value of the Object class; a collection of "named values" - pairs of names (a.k.a. key) and values assigned to those names. As in JavaScript, objects here are universal entities. They can be used as a map (hash map) of name/value pairs, or as real objects - instances of user-defined classes. If the obj variable has an object assigned to it, the following statements both evaluate to true: typeof obj == #object; obj instanceof Object;
Function
The value of the Function class. Functions are first-class entities of the language. Once defined, a function can be assigned to any variable, and passed as a parameter to function calls. If you have the following statement: var foo = function(p) { return p + 1; }, the following two statements evaluate to true: typeof foo == #function; foo instanceof Function;
Class
The value of the Class class; allows to define classes of objects with a specific set of methods and attributes. If you have the declaration: class MyClass { function myMethod() { ... } } you can create instances of the class using the new operator ( var obj = new MyClass() ). The following statement evaluate to true for all classes: typeof MyClass == #class;
Namespace
Namespace is an object (of class Class) that groups multiple variables, constants, and methods into a single named entity. Thus, if you have the declaration: namespace MyNamespace { const myConst = 12; function myMethod() { ... } } you can refer to the members of the namespace using the dot notation as: MyNamespace.myMethod() and MyNamespace.myConst
Length
The value of the Length class. Length values represent lengths - numeric values with unit designators. Length units are constructed by the corresponding length constructor functions. For example, px(12) returns the value representing 12 pixels - mm(12.6), which is 12.6 millimeters. See the description of the Length class for more details. Internally, length values are represented as fixed point values with 0.001 precision. The following three statements evaluate to true: typeof mm(12.6) == #length; mm(12.6) instanceof Length; mm(12.6).units == #mm;
Color
The value of the Color class. Color values represent colors - structures that have the red, green, blue, and the optional alpha fields. Color values are constructed by the color(red,green,blue[,opacity]) function. The following statements all evaluate to true: typeof color(0xFF,0,0) == #color; color(0xFF,0,0) instanceof Color; color(0xFF,0,0).red == 0xFF; color(0xFF,0,0).blue == 0;
Date
The value of the Date class. Date values represent date and time, and are constructed by using the new operator: var date = new Date(2009,7,15). THe following statements evaluate to true: typeof date == #date; date instanceof Date; date.day == 15; date.year == 2009;
Bytes
The value of the Bytes class. An instance of Bytes is an array (sequence) of byte values (integers in range 0 .. 255). The following statements all evaluate to true: typeof (new Bytes(12)) == #Bytes; (new Bytes(12)) instanceof Bytes; (new Bytes(12)).length == 12;
Stream
The value of the Stream class. A stream represents a sequence (possibly unlimited) of elements called stream units. TIScript supports various types of streams that can be created via the Stream.open**** methods: var stream = Stream.openSocket("10.0.0.1:14"); The following statements all evaluate to true: typeof stream == #Stream; stream instanceof Stream;
Regular expression
The value of the RegExp class. A RegExp object is a compiled reqular expression. It is also used for storing information about the results of regular expression pattern matches. Regular expressions can be created by the constructor function of RegExp class, or by the RE-literal: var re = /ain/i; // RE literal r = "The rain in Spain".match(re); // attempts to match search string assert r == "ain";