SIMPOL Documentation

Chapter 2. Introduction

This book provides an introduction and reference guide to programming in SIMPOL, the new Superbase NG programming language for cross-platform development.

A program in SIMPOL is made up of functions. The normal entry point to a program is the function called main(). The most basic possible SIMPOL program is:

function main()
end function

Local Variables, Objects, and Values

Within a program there are local variables, objects and values. Local variables have to be defined as being of a particular type and can only be used for that type. Every object has a type, which is determined when the object is created. Values can be of any type that is permitted for a literal value, or may be null or infinite.

Consider the following program:

function main()
  string s
  s = "Hello world"
end function s

The first statement, string s, defines a local variable called s. The second statement, s = "Hello world", assigns the value "Hello world" to the local variable s. However there is more to the assignment than it might at first appear. Local variables do not hold values, they refer to objects, and it is objects that contain values. In the above program the assignment to s of the string literal "Hello world" causes a new string object to be created, the string literal value is put in the new object and the local variable s is set to refer to that object.