You are here: start » geeny » home » reference » language » conversion

Conversion rules

nul to:

  • ATOM
    • ‘’
  • INTEGER
    • 0
  • FLOAT
    • 0.0
  • VECTOR
    • | 0.0 0.0 0.0 0.0 |
  • REFERENCE
    • ‘’#0 (nul)
  • INSTANCE
    • nul
  • list
    • {}
  • function parameter
    • default value

ATOM to:

  • INTEGER
    • ‘’ converts to 0
    • all other values convert to 1
  • FLOAT
    • ‘’ converts to 0.0
    • all other values convert to 1.0
  • VECTOR
    • ‘’ converts to | 0.0 0.0 0.0 0.0 |
    • all other values convert to | 1.0 1.0 1.0 1.0 |
  • REFERENCE
    • ‘’ converts to nul
    • all other values convert to <atom>#0. If <atom>#0 does not exist, it is created.
  • INSTANCE
    • converts to nul
  • list
    • converts to a single item list.
    • type of the list defines the conversion rule for the single item.
  • ARRAY
    • converts to a single item array
    • item[1] contains the pointer to the input token

INTEGER to:

  • FLOAT
    • common conversion
  • VECTOR
    • converts to | value value value value |
  • ATOM
    • 0 converts to ‘’
    • all other values convert to ‘true’
  • REFERENCE
    • converts to nul
  • INSTANCE
    • converts to nul
  • list
    • converts to a single item list.
    • type of the list defines the conversion rule for the single item.
  • ARRAY
    • converts to a single item array
    • item[1] contains the pointer to the input token

FLOAT to:

  • INTEGER
    • common conversion
  • VECTOR
    • converts to | value value value value |
  • ATOM
    • 0.0 converts to ‘’
    • all other values convert to ‘true’
  • REFERENCE
    • converts to nul
  • INSTANCE
    • converts to nul
  • list
    • converts to a single item list.
    • type of the list defines the conversion rule for the single item.
  • ARRAY
    • converts to a single item array
    • item[1] contains the pointer to the input token

VECTOR to:

  • INTEGER
    • x component is used
  • FLOAT
    • x component is used
  • ATOM
    • x component 0.0 converts to ‘’
    • all other values for x component convert to ‘true’
  • REFERENCE
    • converts to nul
  • INSTANCE
    • converts to nul
  • list
    • converts to a single item list.
    • type of the list defines the conversion rule for the single item.
  • ARRAY
    • converts to a single item array
    • item[1] contains the pointer to the input token

REFERENCE to:

  • INTEGER
    • nul converts to 0
    • all valid references convert to 1
  • FLOAT
    • nul converts to 0.0
    • all valid references convert to 1.0
  • VECTOR
    • nul converts to | 0.0 0.0 0.0 0.0 |
    • all valid references convert to | 1.0 1.0 1.0 1.0 |
  • ATOM
    • converts to template name of the OBJECT
  • INSTANCE
    • converts to nul (todo: converts to owned engine object)
  • list
    • converts to a single item list.
    • type of the list defines the conversion rule for the single item.
  • ARRAY
    • converts to a single item array item[1]
    • contains the pointer to the input token

INSTANCE to:

  • INTEGER
    • nul converts to 0
    • all valid references convert to 1
  • FLOAT
    • nul converts to 0.0
    • all valid references convert to 1.0
  • VECTOR
    • nul converts to | 0.0 0.0 0.0 0.0 |
    • all valid references convert to | 1.0 1.0 1.0 1.0 |
  • ATOM
    • converts to nul (todo: INSTANCE name)
  • REFERENCE
    • converts to nul (todo: converts to owner database object)
  • list
    • converts to a single item list.
    • type of the list defines the conversion rule for the single item.
  • ARRAY
    • converts to a single item array item[1]
    • contains the pointer to the input token

list to:

  • single token data type
    • empty list converts to nul
    • otherwise, list[1] is converted
  • different type of list
    • a new list is generated and each item is converted
  • ARRAY
    • an array of pointers to each item in the list is generated

ARRAY to:

  • single token data type
    • empty list converts to nul
    • otherwise, list[1] is converted
  • list
    • a new list is generated and each item is converted.
 
geeny/home/reference/language/conversion.txt · Last modified: 2015/11/18 07:38 by matija
Recent changes · Show pagesource · Login