SIMPOL Documentation

Chapter 4. Data Types, Values, and Ranges

In this chapter we will discuss the various simple and complex data types that are present in SIMPOL. We will also discuss the valid value ranges, the special values .nul and .inf, functions, supplied complex types, and user-defined types.

To start with, it is important to point out that in SIMPOL, everything is an object. Types are objects, functions are objects, events are objects, and a variable always refers either to an object or to .nul. The scalar data types are also objects, but they are relatively simple objects. In this chapter we will cover the SIMPOL scalar data types: blob, boolean, integer, number, and string. We will also cover some standard included object types: array, date, datetime, and time. Other types will be discussed in depth in their own chapters, such as file streams, sockets, and databases.

Blobs

Blobs provide the SIMPOL programmer with a very powerful data type and mechanism for dealing with raw binary data. Blobs are also value types but they have a number of additional methods related to the ways in which they are most likely to be used.

It is probably easiest to think of blobs as being like a traditional array of bytes and at the same time to be very similar in the way they work to strings. Blobs can be concatenated using the + operator and then assigned to a variable of type blob. The new blob will be the combined length of the two original blobs. It is also possible to create a blob with a pre-determined size. This can be a significant performance improvement over strings, since it is possible to index into the blob using the square brackets operators [] and to then modify the value, whereas with a string concatenation would be used. When done once there is no significant difference but in a loop, concatenation would result in a large number of less efficient memory allocations that wouldn't have been necessary in a blob.