Data TypesDuring the request processing, a number of variables will be declared and used in computations. Some of them will hold final results, to be included in the formatted response to be sent to the client browser. Request input parameters, such as query or form parameters and cookies are made available in a set of predefined variables. All the variables must have a data type, such as:
These data types are generically named simple data types. Container data types, such as arrays, lists, lists of arrays, or maps are named Complex data types. They are based on some of the simple data types: integer, float, and string.
The operator new is used to associate memory to variables of container type. Container variables hold just a reference to the bock of memory storing the contained items. Assigning a container variable to another variable of the same type just copies the reference, making both container variables refer the same data. Modifications done to items through one variable can be seen using the other variable. However, lists have their own cursor, and even if two lists point to the same item sets, they may traverse the items independently. Strings use a similar implementation, containing just a reference to the data itself. However, any string modification implies creating a new storage area to represent the string, so that modifications to one string cannot affect another string. A set of built-in functions help manipulate strings efficiently. Strings obtained from external data sources through resource connectors may be internally represented in multiple parts. This form is efficient when data is passed between resource connectors or is used for response formatting. For any other processing they must be transformed to a single block representation, using a STRING modifier. Data types are used in variables declarations. |
|