• Reference Guide

Data Types

This subsection contains a list of user-defined data types. Its purpose is to allow the user to assign a name to a frequently used type and facilitate thus its usage. For example, you can define an Address type corresponding to a structure containing first name, last name, street, zip code, city, and country. After that you just use this newly defined type whenever you need to use an address. Another advantage of a named type is that if you modify its definition here, in a single place, all applications of the type are modified. Suppose you have created a table of addresses using the Address type defined this way. If you add the Title item to the address definition, a new column automatically appears in the existing table. If there are multiple tables, the change is reflected in all of them.
A defined type is used by the data type editor by selecting the named type category and entering the name assigned here in the table (Address in this example). For example, if you wish to create a list of addresses, select the Table type, change the element data type from Structure to Named and enter Address as the name.
In the Enki language, simply use the name of the type just like in any other situation.
For example:
var Address adr = {"John", "Newman", "22 High Street", 98101, "Seattle"};
A table is displayed for this subsection in the right pane of the document main window, where every row corresponds to one defined type. First of all you need to assign a name to every new type you create. The name must be an identifier. It is also recommended that the name starts with a capital letter. This helps you distinguish data type names from other names. This convention is observed by Sfairadora built-in data types.
Then there is the data type editor used to define the named type. In most cases it will probably be a structure or another compound type. For compound data types, the details button appears on the row that invokes a window for precise specification of the data type properties. For example, if you select a structure, these properties comprise the names and types of its elements.