Tips and Tricks for SIMPOL Professional
This section is dedicated to providing interesting bits of information that may save people time or effort when using SBNG or SIMPOL. If you have a useful suggestion, then submit it to us and we may incorporate it in this section so that everyone can profit from it.
For SBL Programmers Learning SIMPOL
Watch out for = and ==
In BASIC and SBL, the equals sign (=) is used both for assignment and to test for equivalency. In SIMPOL, the equals sign (=) is for assignment and the double equals sign (==) is used to test for equivalency.
Understanding the @ symbol in SIMPOL
In Object SBL (v3.00 and later) to assign an object to a variable, you use
SET var = object but in SIMPOL this is done by using the reference operator (@). You can use either (@=) or (=@), both are equivalent in their functionality. To test for equivalence with objects in SBL, you used
IF IS (var, object) THEN or to test for a non-existent object you used
IF IS (var, NOTHING) THEN. In SIMPOL, you use
if var =@= object or to test for a non-existent object, you use
if var =@= .nul.
Variables Need to be both Declared and Initialized
In BASIC and SBL, you aren’t required to use the
GLOBAL keyword to declare variables. This is easy, but is also a common source of strange bugs in programs as the programs get bigger. In SIMPOL, it is required to declare a variable before using it. Also, variables in SBL default to either the value 0 or the empty string “”, depending on the data type of the variable. In SIMPOL, all variables default to the value
.nul until they are initialized. It is extremely important to be aware of this. If you are passing an integer variable to a function as the error value, the integer variable must be initialized first by assigning a value to it, like the value 0. With non-value types (anything other than
string, this must be done using the reference assignment operator (
=@) and is done either by calling the
.new() method of the type or by calling a function or method that returns an object of that type.
SIMPOL is Very Case-Sensitive
Almost everything in SIMPOL is case-sensitive. The only exception to this might be file names on file systems that are case-insensitive. Internally, variables, type names, function names, database table names (including in PPCS and SBME), property names, etc. are all case-sensitive! This may be annoying at first, but since SBL was partially case-sensitive, it is at least consistent across the product, which was an important aspect of the design of SIMPOL.
Error Values Are Not Always Modified!
In many places in SIMPOL, the creation or searching for an object takes an integer error value, that must be an existing object. If no error occurs, then no value is written to the integer object. Therefore, if the object is not initialized to a known value, and no error occurs, no change will be made to the value of the integer. This means that in function calls that return an object and that take an error value, it is best to test for the return of an object, not the error value. Testing the error value is only useful if the object that was returned was equal to