Share

Clarion language at a glance

Soft velocity call the Clarion language a 4-GL language, which means that four generations ago, it would be considered a language :-). Seriously though it has many limitations concerning supported data types, constraints on the types that are allowed to be passed to an from procedures, and even the maximum number of procedures allowed within an application! For example, if you want a string that can contain more than 256 characters, you will have to use a fixed length string or buy a 3rd party string type (which you will probably have to convert from and to a fixed length one when using it in one of the templates or database). Anyway, compared to modern languages, it has a long-long way to go.

The hierarchy

A clarion project (.exe or .dll) contains:

  • Project
    • Modules
      • Procedures
        • Routines

Variables can be declared at each level and are visible in all underlying levels. Only procedures can have parameters and return types. Routines will usually manipulate variables that are declared on the procedure they are in.

Procedures often use global variables (those declared on Project level) instead of parameters. The standard Clarion templates for example, set a GLOBALREQUEST variable before calling another procedure and read GLOBALRESULT when flow-of-control returns. This practice makes multithreading quite impossible (when using standard templates).

It is quite rare to see a variable declared on module level. I see modules as "IsDirty" containers. After editing something in a model, all templates will generate their code again, which will take a while. Using modules one can limit this activity to a portion of the project. Unaltered modules will compile allot faster.

The Babylonian confusion of Get and Set

In Clarion Get and set have nothing to do with getters or setters or properties. They have to do with database communication. They both do the same thing: retrieving data.

Get can be compared to an sql statement that retrieves one single record from a table. The key will have to match exactly.

Set is used before looping through a range of records. The key does not have to match exactly (“B” will bring you to the first entry starting with a “B”). After calling Set, you must call Next in order to get the first record.

For updating one would call Put, for inserting Add and for removing Delete.