5.01 Types

LynPlex uses the TYPE command to define storage maps or structures.

A structure is used to define a particular record or control block layout. Unlike dynamic arrays, the actual position and size of each element is important. Once defined, the definition of a type can not be changed.

Types are defined using the TYPE statement.

The TYPE Statement

TYPE typename
  elements 
  END

TYPE Elements

[.]name [as] datatype
[as] datatype [.]name

TYPE Functions

Functions can be defined as belonging to a Type. They do not have to be defined within the type definition. Any function defined with a name in the format:

typename.function()

is automatically defined within the type.

Where a function is defined with the same name as a field or element of a type it will be used in preference. In this way individual fields can be masked and their access controlled instead by a function.

The CONSOLE Type

The console interface behaves as if it is defined as a type, although it is not one a such. Individual fields can be updated directly or indirectly just as with a type and have an effect on subsequent processing. See 3.05 Consoles for details.

Implementation Status:

LynPlex Interpreter
Types are currently under development.
LynPlexC Compiler
Types are fully implemented using the format “name as datatype”. Format “.datatype name” to be implemented. The with statement is also supported. Extended types/classes are under development.
LynPlexS Compiler
Types are fully implemented using the format “.datatype name”. Format “name as datatype” to be implemented. Extended types/classes are under development.

lynplex/lp0501.txt · Last modified: 2011/09/08 16:07 (external edit)