Difference between revisions of "Special Purpose Operators"
Yvonnemilne (Talk | contribs) |
Yvonnemilne (Talk | contribs) |
||
Line 2: | Line 2: | ||
− | ==The Macro Operator (&)== | + | ==The Macro Operator/Function ([[&]])== |
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 | + | 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|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 |
Latest revision as of 14:43, 24 March 2009
Three special operators exist within the Recital/4GL. These are:
Contents
The Macro Operator/Function (&)
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 <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 ’.’ 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