up: TYPE     index Zimbu documentation

CLASS T.type @public

summary

     

The builtin type type.

It stores the properties of a type.

type can also be used in a SWITCH statement:

 SWITCH anyVar.Type()
   CASE T.int
     IO.print("anyVar is an int")
   CASE T.string
     IO.print("anyVar is a string")
 }

$ToString() string @public  Return a string representation of the type.
$Size() int @public  Return the size of the type.
$Type() type @public  Return the type of the type.
$Compare(other) int @public  Return -1 or 1 when other differs from this type, zero when other is equal to this type.
$Equal(other) bool @public  Return TRUE when other is equal to this type, FALSE otherwise.
$name() string @public  Return the name of the item.
 
 

members (alphabetically)

     

FUNC $Compare(type other) int @public

     

Return -1 or 1 when other differs from this type, zero when other is equal to this type.

Whenter 1 or -1 is returned is consistent but unpredictable. This makes it possible to sort types, but the resulting order is undefined.

FUNC $Equal(type other) bool @public

     

Return TRUE when other is equal to this type, FALSE otherwise.

FUNC $Size() int @public

     

Return the size of the type.

This always returns the same value, which is the size of the type itself. It does NOT return the size of the type it stores the properties of.

FUNC $ToString() string @public

     

Return a string representation of the type.

E.g. "string", "enum Color", "object of Foo".

FUNC $Type() type @public

     

Return the type of the type.

This always results in the same type with the properties of a type.

FUNC $name() string @public

     

Return the name of the item.

E.g. "MyModule", "FooClass", "theVar". When the object is NIL this returns "NIL".

license

      Copyright 2013 Bram Moolenaar All Rights Reserved.

      Licensed under the Apache License, Version 2.0. See the LICENSE file or obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0