Difference between revisions of "Special Purpose Operators"

From Recital Documentation Wiki
Jump to: navigation, search
 
Line 1: Line 1:
 
Three special operators exist within the Recital/4GL.  These are:
 
Three special operators exist within the Recital/4GL.  These are:
  
====The Macro Operator (&)====
+
==The Macro Operator (&)==
 
When an ’&’ ampersand character precedes a variable or an expression contained within parentheses, the result of the expression is substituted into the command.  Nested macros are not supported.
 
When an ’&’ ampersand character precedes a variable or an expression contained within parentheses, the result of the expression is substituted into the command.  Nested macros are not supported.
  
====The Alias Operator (->)====
+
==The Alias Operator (->)==
 
An open table can be referred to by its alias name and its fields can be accessed using the alias operator.  The alias name is either a name you have specified in the USE <table> ALIAS <alias name> command, or, by default, the first ten characters of the table basename.  The letters a-z (excluding m) can also be used as an alias to the work areas 1-26 (excluding 13).  M is used to reference memory variables, so is not available as a table alias
 
An open table can be referred to by its alias name and its fields can be accessed using the alias operator.  The alias name is either a name you have specified in the USE <table> ALIAS <alias name> command, or, by default, the first ten characters of the table basename.  The letters a-z (excluding m) can also be used as an alias to the work areas 1-26 (excluding 13).  M is used to reference memory variables, so is not available as a table alias
  
====The Dot Operator (.)====
+
==The Dot Operator (.)==
 
The dot operator ’.’ is used to reference either the properties of objects, or it can be used interchangeably with the alias operator.
 
The dot operator ’.’ is used to reference either the properties of objects, or it can be used interchangeably with the alias operator.
  

Revision as of 14:38, 24 March 2009

Three special operators exist within the Recital/4GL. These are:

The Macro Operator (&)

When an ’&’ ampersand character precedes a variable or an expression contained within parentheses, the result of the expression is substituted into the command. Nested macros are not supported.

The Alias Operator (->)

An open table can be referred to by its alias name and its fields can be accessed using the alias operator. The alias name is either a name you have specified in the USE ALIAS <alias name> command, or, by default, the first ten characters of the table basename. The letters a-z (excluding m) can also be used as an alias to the work areas 1-26 (excluding 13). M is used to reference memory variables, so is not available as a table alias

The Dot Operator (.)

The dot operator ’.’ is used to reference either the properties of objects, or it can be used interchangeably with the alias operator.


Example

// Macro Operator Example
cTABLE = [employees]
use &cTABLE
 
// Alias Operator Example
cEMPNAME = &(cTABLE + "->NAME")
 
// Dot Operator Example
use employees
 
class EmpRecord
  public:
property NAME
property SALARY
  public:
method IDENT
return "Employee Record"
endclass
 
oMYREC = new EmpRecord()
cTYPE = oMYREC.IDENT()
? cTYPE