The Sisendel language defines a set of basic
types, most of which are similar, or even identical, to the basic
types of several computer languages, like C and its derivatives, or
Java[tm]: types like bool, or float, or the different integer
types are common to the most part, if not all, of those languages.
Some additional basic types of Sisendel derive from types available
in database-specific languages, such as SQL: for example,
time and unique_id, or similar types, are often
used in database tables.
The following table describes all Sisendel basic types. As noted
in the table, some field types require additional detailed information
in an appropriate section (called DEFS) of the relevant entity file.
Table 1 - Basic types in Sisendel
Type id
|
Description
|
Notes
|
bool
|
Boolean value
|
-
|
enum
|
Enumerated value
|
Enumeration values must be defined in section DEFS
|
float
|
Floating point number
|
Lower and upper bound of validity range may optionally be defined in section DEFS
|
function
|
Computational object
|
Function parameters and return value(s) must be defined in section DEFS
|
int8
|
Signed 8-bit integer number
|
-
|
int16
|
Signed 16-bit integer number
|
-
|
int32
|
Signed 32-bit integer number
|
-
|
int64
|
Signed 64-bit integer number
|
-
|
range
|
Range of integer values
|
Lower and upper bound of range must be defined in section DEFS
|
string
|
String of characters
|
Length of string must be specified, may be dynamic
|
thing
|
Generic object
|
Can be used as a placeholder for complex or multimedia objects, such as documents, sound files, and videoclips (or smell, taste and tactile files in the future).
|
time
|
Time value
|
-
|
uint8
|
Unsigned 8-bit integer number
|
-
|
uint16
|
Unsigned 16-bit integer number
|
-
|
uint32
|
Unsigned 32-bit integer number
|
-
|
uint64
|
Unsigned 64-bit integer number
|
-
|
unique_id
|
Unique identifier
|
-
|
Arrays of basic types are defined by specifying their size - possibly
dynamic - in square brackets after the field identifier.
Basic types can also be imported from other entities: this
feature of Sisendel allows to centralize and share the
definition of commonly
used simple types, such as identifiers, descriptors and numeric
quantities.
The following code example shows several definitions of basic type
fields.
Code Example 2 - Use of basic types
|
File "theater_seat.ef" contains a software representation
of a theater seat, defining several fields, but
with no collection in sections DB, LOGIC and UI,
to keep the example simple.
Some notes:
- Line 12 shows an example of a dynamic array of strings (purchaser);
- Line 13 shows an example of an imported type definition (customization): library entity "strings.ef" contains a fixed-size string field called description;
- Lines 16-20 define enumeration symbols and values for field type;
- Lines 22-23 define input parameters (number) and return value (type) of function cur_type;
- Lines 25-26 define a validity range for field price;
- Lines 28-29 define input parameters (type and purchaser) and return value (price) of function cur_price.
|
|
Source code - File "theater_seat.ef"
|
1 theater_seat "Theater seat"
2 | Entity representing a theater seat,
3 | actually an example of usage of built-in types
4
5 unique_id number "Seat number"
6 bool available "Available"
7 enum type "Seat type"
8 function cur_type "Curr. seat type"
9 float price "Price range"
10 | Price range expressed in USD
11 function cur_price "Curr. price"
12 string purchaser[dyn] "Purchaser"
13 strings.description customization "Customization"
14
15 ----------------------- DEFS
16 type:
17 stalls 'S' "Stalls"
18 pit 'P' "Pit"
19 box 'B' "Box"
20 gallery 'G' "Gallery"
21
22 cur_type:
23 number -> type
24
25 price:
26 0/7000
27
28 cur_price:
29 type, purchaser -> price
30 ----------------------- DB
31 ----------------------- LOGIC
32 ----------------------- UI
33 ----------------------- ADJUST
|
|
[Previous chapter]
[Next chapter]
[Back to top]
|