Language Changes in Clarion#

Top  Previous  Next

 

·

You cannot use keywords as labels or identifiers unless they include the @@ as a prefix (i.e., @@IF). You also should use @@ as a prefix if you'd like to use Construct or Destruct as a label for a declaration that is not a constructor/destructor.

 

When migrating from Clarion Win32 applications to Clarion#, there are several important factors to note:

·

All arrays in Clarion# are now zero-based. This means that all string functions using position parameters (e.g., SUB), and other array processing functions (e.g., MAXIMUM) are now processed with zero-based indexes in Clarion#. See the Notes on Zero-Based Arrays FAQ for more information.

·

We have removed the requirement to use and declare a reference to an object in the data section. The & operator is only required when you want to declare a reference to a value type.

·

A reference assignment to an object no longer requires the &= operator. Use the equal sign (=) now for all reference types.

Example:

 

Aa System.ICloneable

Bb System.ICloneable

CODE

Aa = Bb     !formerly we wrote Aa &= Bb

 

·

A reference type can be declared without the & and if the declaration doesn't have any parameters, the object will not be instantiated.

Example:

 

MyClass.P2 PROCEDURE()

A    MyCollection   !just a declaration requires explicit instantiation

B    MyClass()      !automatically calls the default constructor

  CODE

 

·

Automatic instantiation of objects is no longer supported. In other words all reference types are implicitly a TYPE.

 

Aa CLASS,TYPE

…

END

 

…is now equivalent to:

 

Aa CLASS

…

END

 

·

Clarion# now uses zero based indexes for all arrays and collections. But FILEs and QUEUEs will still use 1-based indexes. The rationale behind this change is that this makes it easier to work with the core Framework objects, 3rd-party .Net libraries, shared libraries you may write, as well as make it easier to translate code samples from C# or VB.

·

Automatic disposal of objects is no longer supported. Use AUTODISPOSE to do this if needed. It is the programmer’s responsibility to create an object instance and thus it is the programmer's responsibility to call DISPOSE (if needed).

·

Assigning an object to an object copies the object’s content only if both objects have the same type, or if the source class is derived from the target type

·

ADDRESS function is not supported

·

OVER keyword is not supported

·

Implicit variables are currently not supported in the PROGRAM CODE section.

·

REPLACE keyword in constructors is not supported.

·

The call of a constructor of the parent class must be the first statement in a constructor.

·

Multi-dimensional arrays can’t be thought of as nested. So, when accessing an array the number of indices should be equal to dimensions of the array.

·

There are special "compatible types" added to provide compatibility with Clarion WIN32 language. The list of such types includes: CLASTRING, CLADECIMAL.

·

PRIVATE, PROTECTED keyword for CLASS’s members have different semantics as compared with Clarion Win32. The implemented semantic is the same as in C#.

·

Reference Data Types implemented with some restrictions (see Reference Data Type for more details)

·

Restricted support of assigning GROUP to CLASTRING (see GROUP implementation in Clarion .NET)

·

It is not possible in Clarion# to perform a reference assignment using the ADDRESS function.

·

A CLASS can’t be declared locally inside a ROUTINE

·

A Procedure declared without the TYPE attribute can’t be passed as a Parameter

·

Multiple Constructors with parameters are now supported

·

In Clarion# you can now use NEW as an operator in any expression

·

In Clarion# you can now use string slicing in MEMO data types.

·

DISPOSE behavior is different in Clarion#

·

In the Clarion Win32 language there are three accessibility levels for members of a class: PUBLIC(default), PRIVATE, PROTECTED. Clarion .NET introduced a new accessibility level: INTERNAL – meaning that the member is accessible to all code inside the same assembly.

 

In summary:

PUBLIC - accessible to all code in any assembly

INTERNAL - accessible to all code inside the same assembly (default)

PROTECTED - accessible only to code of classes that extend the class where the named entity exits

PRIVATE - only accessible to code that belongs to the same class

·

PROGRAM and MEMBER statements now support PUBLIC and INTERNAL default access modifiers.

·

All statements referencing WINDOW elements are no longer supported. This includes:

DISPLAY, CHANGE, ERASE, UPDATE and many more. Each statement and its target support is documented in each topic.

·

Testing for NULL values should be done via reference assignments:

For example:

 

IF NOT (myObjectReference &= NULL)

 

or

 

IF (myObjectReference &= NULL)

 

Finally, there are several data types used in Win32 based FILE structures that are not supported in Clarion#. The application templates will handle the automatic conversion of these data types, but if you are hand coding any project you will need to make the following changes:

 

Clarion WIN32

Clarion# Equivalent

DECIMAL

CLADECIMAL

LONG

CLALONG

STRING

CLASTRING

ULONG

CLAULONG

 

See Also: Clarion# Data Type Comparison Chart