Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EDT:EGL Language"

Line 9: Line 9:
 
*'''Developers:''' include a link to Bugzilla for features not done yet, and mark items "Done" when you're finished.
 
*'''Developers:''' include a link to Bugzilla for features not done yet, and mark items "Done" when you're finished.
  
== Table 1: Part Types  ==
+
== Part Types (Table 1) ==
  
 
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
 
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
Line 131: Line 131:
 
#<span style="background:#FFA500">Nullability means that a variable may really be null.  It's not an "I'm null" flag like in RBD.  A NullValueException will be thrown if you try to access a field or function of a null variable, even a record. A NullValueException will be thrown if a null variable is an operand to a math operator, an array access, a substring access, a comparison, or a bitwise operator.</span> The string concatenation operators will work the same as in RBD with respect to nulls. &nbsp;:: treats null as the empty string, and&nbsp;?: results in null if either operand is null. <span style="background:#FFA500">A question mark won't be allowed on the second operand of the AS and ISA operators (the name of the type).</span>
 
#<span style="background:#FFA500">Nullability means that a variable may really be null.  It's not an "I'm null" flag like in RBD.  A NullValueException will be thrown if you try to access a field or function of a null variable, even a record. A NullValueException will be thrown if a null variable is an operand to a math operator, an array access, a substring access, a comparison, or a bitwise operator.</span> The string concatenation operators will work the same as in RBD with respect to nulls. &nbsp;:: treats null as the empty string, and&nbsp;?: results in null if either operand is null. <span style="background:#FFA500">A question mark won't be allowed on the second operand of the AS and ISA operators (the name of the type).</span>
  
== Table 2: Function Parameters  ==
+
== Function Parameters (Table 2) ==
  
 
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
 
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
Line 188: Line 188:
 
#The default parameter modifier is <span style="background:#FFA500">In for references</span> and Inout for values.<br>
 
#The default parameter modifier is <span style="background:#FFA500">In for references</span> and Inout for values.<br>
  
== Table 3: Primitive Types  ==
+
== Primitive Types (Table 3) ==
  
 
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
 
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
Line 405: Line 405:
 
#<span style="background:#FFA500">Number is a reference type with an immutable value. Unlike in RBD, number variables can be declared anywhere a variable declaration is allowed.</span>  
 
#<span style="background:#FFA500">Number is a reference type with an immutable value. Unlike in RBD, number variables can be declared anywhere a variable declaration is allowed.</span>  
 
#Bytes(N) is a value type similar to RBD's hex. N indicates the number of bytes in the value. (In RBD, the length of a hex is the number of nibbles not the nubmer of bytes.)  
 
#Bytes(N) is a value type similar to RBD's hex. N indicates the number of bytes in the value. (In RBD, the length of a hex is the number of nibbles not the nubmer of bytes.)  
#Bytes with no length is a reference type with an immutable value of any length.
+
#Bytes with no length is a reference type with an immutable value of any length.<br>
 +
 
 +
== Conversions Between Primitive Types (Table 4)  ==
 +
 
 +
=== Conversion Matrix  ===
 +
 
 +
Rows = from type, columns = to type
 +
 
 +
{| cellspacing="1" cellpadding="1" border="1"
 +
|-
 +
| <br>
 +
| bigint<br>
 +
| boolean<br>
 +
| bytes<br>
 +
| decimal<br>
 +
| float<br>
 +
| &nbsp; int&nbsp; <br>
 +
| number<br>
 +
| smallfloat<br>
 +
| smallint<br>
 +
| string<br>
 +
| timestamp<br>
 +
|-
 +
| bigint<br>
 +
| align="center" | a<br>
 +
| align="center" | <br>
 +
| align="center" | g<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | d<br>
 +
| align="center" | <br>
 +
|-
 +
| boolean<br>
 +
| align="center" | <br>
 +
| align="center" | a<br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | b<br>
 +
| align="center" | <br>
 +
|-
 +
| bytes<br>
 +
| align="center" | g<br>
 +
| align="center" | <br>
 +
| align="center" | a<br>
 +
| align="center" | g<br>
 +
| align="center" | g<br>
 +
| align="center" | g<br>
 +
| align="center" | g<br>
 +
| align="center" | g<br>
 +
| align="center" | g<br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
|-
 +
| decimal<br>
 +
| align="center" | f<br>
 +
| align="center" | <br>
 +
| align="center" | g<br>
 +
| align="center" | a<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | d<br>
 +
| align="center" | <br>
 +
|-
 +
| float<br>
 +
| align="center" | f<br>
 +
| align="center" | <br>
 +
| align="center" | g<br>
 +
| align="center" | f<br>
 +
| align="center" | a<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | d<br>
 +
| align="center" | <br>
 +
|-
 +
| int<br>
 +
| align="center" | f<br>
 +
| align="center" | <br>
 +
| align="center" | g<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | a<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | d<br>
 +
| align="center" | <br>
 +
|-
 +
| number<br>
 +
| align="center" | f<br>
 +
| align="center" | <br>
 +
| align="center" | g<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | a<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | d<br>
 +
| align="center" | <br>
 +
|-
 +
| smallfloat<br>
 +
| align="center" | f<br>
 +
| align="center" | <br>
 +
| align="center" | g<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | a<br>
 +
| align="center" | f<br>
 +
| align="center" | d<br>
 +
| align="center" | <br>
 +
|-
 +
| smallint<br>
 +
| align="center" | f<br>
 +
| align="center" | <br>
 +
| align="center" | g<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | f<br>
 +
| align="center" | a<br>
 +
| align="center" | d<br>
 +
| align="center" | <br>
 +
|-
 +
| string<br>
 +
| align="center" | d<br>
 +
| align="center" | <br>
 +
| align="center" | e<br>
 +
| align="center" | d<br>
 +
| align="center" | d<br>
 +
| align="center" | d<br>
 +
| align="center" | d<br>
 +
| align="center" | d<br>
 +
| align="center" | d<br>
 +
| align="center" | a<br>
 +
| align="center" | c<br>
 +
|-
 +
| timestamp<br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | <br>
 +
| align="center" | c<br>
 +
| align="center" | a<br>
 +
|}
 +
 
 +
blank = conversion not supported
 +
 
 +
a = Same types (not a conversion)
 +
 
 +
b = Booleans convert to strings as "true" or "false" (lowercase).
 +
 
 +
c = <span style="background:#FFA500">Strings convert to/from timestamps: the string is parsed, fields come from the timestamp's declaration, we'll pick a format...no conversion to timestamp w/o pattern allowed because it's ambiguous.</span>
 +
 
 +
d = <span style="background:#FFA500">Strings convert to/from numbers using our literal syntax for numbers.</span>
 +
 
 +
e = Strings convert to bytes using the bit pattern of the Unicode characters in the string.
 +
 
 +
f = All numeric types are compatible with each other, but some conversions can result in overflow or truncation.
 +
 
 +
g = Numeric types convert to/from bytes using the number's bit pattern. When the bytes type includes a size (i.e. "bytes(4)" not just "bytes") the conversion is legal only if the size of the number in bytes equals the length of the bytes type.  
  
== Table 4: Statements  ==
+
 
 +
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
 +
|-
 +
| bgcolor="#999999" align="center" | '''''Conversions Between Primitive Types<sup>1</sup>'''''
 +
| bgcolor="#999999" align="center" | '''Core'''
 +
| bgcolor="#999999" align="center" | '''JavaScript'''
 +
| bgcolor="#999999" align="center" | '''Java'''
 +
| bgcolor="#999999" align="center" | '''Debug'''
 +
|-
 +
| bgcolor="#cccccc" | ''Any to everything''
 +
| <br>
 +
| <br>
 +
| <br>
 +
| <br>
 +
|-
 +
| bgcolor="#cccccc" | ''Everything to any''
 +
| <br>
 +
| <br>
 +
| <br>
 +
| <br>
 +
|-
 +
| bgcolor="#cccccc" | ''Conversion Matrix b''
 +
| <br>
 +
| <br>
 +
| <br>
 +
| <br>
 +
|-
 +
| bgcolor="#cccccc" | ''Conversion Matrix c''
 +
| <br>
 +
| <br>
 +
| <br>
 +
| <br>
 +
|-
 +
| bgcolor="#cccccc" | ''Conversion Matrix d''
 +
| <br>
 +
| <br>
 +
| <br>
 +
| <br>
 +
|-
 +
| bgcolor="#cccccc" | ''Conversion Matrix e''
 +
| <br>
 +
| <br>
 +
| <br>
 +
| <br>
 +
|-
 +
| bgcolor="#cccccc" | ''Conversion Matrix f''
 +
| <br>
 +
| <br>
 +
| <br>
 +
| <br>
 +
|-
 +
| bgcolor="#cccccc" | ''Conversion Matrix g''
 +
| <br>
 +
| <br>
 +
| <br>
 +
| <br>
 +
|}
 +
 
 +
'''Notes on Table 4'''
 +
 
 +
#We'll document error conditions of conversions, and their resulting exceptions. Whenever possible this documentation will be comments in the EGL source file for a type. <br>
 +
 
 +
== Statements (Table 5) ==
  
 
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
 
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
Line 634: Line 877:
 
|}
 
|}
  
'''Notes on Table 4'''<br>  
+
'''Notes on Table 5'''<br>  
  
 
#EDT won't support every variation of RBD's move statement. There will be support for '''move byName''', '''move for''', and '''move for all'''. A move statement without one of the additional keywords is only allowed between two references, and it results in the target being assigned a copy of the source's value. If/when we support structured records, we might not support '''move byName''' on them because of the complex (unclean) design.  
 
#EDT won't support every variation of RBD's move statement. There will be support for '''move byName''', '''move for''', and '''move for all'''. A move statement without one of the additional keywords is only allowed between two references, and it results in the target being assigned a copy of the source's value. If/when we support structured records, we might not support '''move byName''' on them because of the complex (unclean) design.  
Line 644: Line 887:
 
<br>  
 
<br>  
  
== Table 5: Literals  ==
+
== Literals (Table 6) ==
  
 
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
 
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
Line 655: Line 898:
 
|-
 
|-
 
| bgcolor="#cccccc" | ''null''  
 
| bgcolor="#cccccc" | ''null''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''boolean<sup>1</sup>''  
 
| bgcolor="#cccccc" | ''boolean<sup>1</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''integer<sup>2</sup>''  
 
| bgcolor="#cccccc" | ''integer<sup>2</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''fixed-decimal<sup>3</sup>''  
 
| bgcolor="#cccccc" | ''fixed-decimal<sup>3</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''floating point''  
 
| bgcolor="#cccccc" | ''floating point''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''string<sup>4</sup>''  
 
| bgcolor="#cccccc" | ''string<sup>4</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''bytes<sup>5</sup>''  
 
| bgcolor="#cccccc" | ''bytes<sup>5</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''array''  
 
| bgcolor="#cccccc" | ''array''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''char''  
 
| bgcolor="#cccccc" | ''char''  
| <br>
+
| <br>  
 
| N/S  
 
| N/S  
 
| N/S  
 
| N/S  
Line 709: Line 952:
 
|-
 
|-
 
| bgcolor="#cccccc" | ''mbchar''  
 
| bgcolor="#cccccc" | ''mbchar''  
| <br>
+
| <br>  
 
| N/S  
 
| N/S  
 
| N/S  
 
| N/S  
Line 715: Line 958:
 
|-
 
|-
 
| bgcolor="#cccccc" | ''dbchar''  
 
| bgcolor="#cccccc" | ''dbchar''  
| <br>
+
| <br>  
 
| N/S  
 
| N/S  
 
| N/S  
 
| N/S  
Line 721: Line 964:
 
|-
 
|-
 
| bgcolor="#cccccc" | ''hex''  
 
| bgcolor="#cccccc" | ''hex''  
| <br>
+
| <br>  
 
| N/S  
 
| N/S  
 
| N/S  
 
| N/S  
Line 727: Line 970:
 
|}
 
|}
  
'''Notes on Table 5'''<br>  
+
'''Notes on Table 6'''<br>  
  
 
#As in RBD, there are four boolean literals: true false yes no  
 
#As in RBD, there are four boolean literals: true false yes no  
Line 735: Line 978:
 
#A bytes literal is written as 0x or 0X followed by an even number of hexadecimal digits. For example 0x03AB is a literal whose type is bytes(2).
 
#A bytes literal is written as 0x or 0X followed by an even number of hexadecimal digits. For example 0x03AB is a literal whose type is bytes(2).
  
== Table 6: Operators and expressions  ==
+
== Operators and expressions (Table 7) ==
  
 
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
 
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
Line 746: Line 989:
 
|-
 
|-
 
| bgcolor="#cccccc" | ''. (member access)''  
 
| bgcolor="#cccccc" | ''. (member access)''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''=''  
 
| bgcolor="#cccccc" | ''=''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''function invocation''  
 
| bgcolor="#cccccc" | ''function invocation''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''new''  
 
| bgcolor="#cccccc" | ''new''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''{ } (set-values block)''  
 
| bgcolor="#cccccc" | ''{ } (set-values block)''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''@''  
 
| bgcolor="#cccccc" | ''@''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''[ ] (array access)''  
 
| bgcolor="#cccccc" | ''[ ] (array access)''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''[ ] (dynamic access)''  
 
| bgcolor="#cccccc" | ''[ ] (dynamic access)''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''[ ] (substring)<sup>2</sup>''  
 
| bgcolor="#cccccc" | ''[ ] (substring)<sup>2</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''isa<sup>3</sup>''  
 
| bgcolor="#cccccc" | ''isa<sup>3</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''as<sup>3</sup>''  
 
| bgcolor="#cccccc" | ''as<sup>3</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''unary (+ -&nbsp;! ~)<sup>4, 5</sup>''  
 
| bgcolor="#cccccc" | ''unary (+ -&nbsp;! ~)<sup>4, 5</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''math (+ - * /&nbsp;% **)<sup>9</sup>''  
 
| bgcolor="#cccccc" | ''math (+ - * /&nbsp;% **)<sup>9</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''assigning math (+= -= *= /=&nbsp;%= **=)<sup>9</sup>''  
 
| bgcolor="#cccccc" | ''assigning math (+= -= *= /=&nbsp;%= **=)<sup>9</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''::''  
 
| bgcolor="#cccccc" | ''::''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''?:''  
 
| bgcolor="#cccccc" | ''?:''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''logical (And Or &amp;&amp; &#124;&#124;)''  
 
| bgcolor="#cccccc" | ''logical (And Or &amp;&amp; &#124;&#124;)''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''comparison (&lt; &gt; &lt;= &gt;= ==&nbsp;!=)''  
 
| bgcolor="#cccccc" | ''comparison (&lt; &gt; &lt;= &gt;= ==&nbsp;!=)''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''bitwise (&amp; &#124; Xor &lt;&lt; &gt;&gt; &gt;&gt;&gt;)<sup>4, 5</sup>''  
 
| bgcolor="#cccccc" | ''bitwise (&amp; &#124; Xor &lt;&lt; &gt;&gt; &gt;&gt;&gt;)<sup>4, 5</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''assigning bitwise (&amp;= &#124;= Xor= &lt;&lt;= &gt;&gt;= &gt;&gt;&gt;=)<sup>4, 5</sup>''  
 
| bgcolor="#cccccc" | ''assigning bitwise (&amp;= &#124;= Xor= &lt;&lt;= &gt;&gt;= &gt;&gt;&gt;=)<sup>4, 5</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''if-then-else'' (condition&nbsp;? val1&nbsp;: val2)''<sup>6</sup>''  
 
| bgcolor="#cccccc" | ''if-then-else'' (condition&nbsp;? val1&nbsp;: val2)''<sup>6</sup>''  
| <br>
+
| <br>  
| <br>
+
| <br>  
| <br>
+
| <br>  
 
| <br>
 
| <br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''in<sup>7</sup>''  
 
| bgcolor="#cccccc" | ''in<sup>7</sup>''  
| <br>
+
| <br>  
 
| N/S  
 
| N/S  
 
| N/S  
 
| N/S  
Line 878: Line 1,121:
 
|-
 
|-
 
| bgcolor="#cccccc" | ''like matches<sup>8</sup>''  
 
| bgcolor="#cccccc" | ''like matches<sup>8</sup>''  
| <br>
+
| <br>  
 
| N/S  
 
| N/S  
 
| N/S  
 
| N/S  
Line 884: Line 1,127:
 
|}
 
|}
  
'''Notes on Table 6'''<br>  
+
'''Notes on Table 7'''<br>  
  
 
#We'll document error conditions of operators and expressions, and their resulting exceptions. Whenever possible this documentation will be comments in the EGL source file for a type.  
 
#We'll document error conditions of operators and expressions, and their resulting exceptions. Whenever possible this documentation will be comments in the EGL source file for a type.  
Line 896: Line 1,139:
 
#Date/time math is not supported in EDT. Functions on the timestamp type provide similar behavior.
 
#Date/time math is not supported in EDT. Functions on the timestamp type provide similar behavior.
  
== Table 7: Conversions Between Primitive Types  ==
+
<br> <br>  
 
+
{| width="400" cellspacing="1" cellpadding="1" border="1" style=""
+
|-
+
| bgcolor="#999999" align="center" | '''''Conversions Between Primitive Types<sup>1</sup>'''''
+
| bgcolor="#999999" align="center" | '''Core'''
+
| bgcolor="#999999" align="center" | '''JavaScript'''
+
| bgcolor="#999999" align="center" | '''Java'''
+
| bgcolor="#999999" align="center" | '''Debug'''
+
|-
+
| bgcolor="#cccccc" | ''Any to everything''
+
| <br>
+
| <br>
+
| <br>
+
| <br>
+
|-
+
| bgcolor="#cccccc" | ''Everything to any''
+
| <br>
+
| <br>
+
| <br>
+
| <br>
+
|-
+
| bgcolor="#cccccc" | ''Conversion Matrix 2''
+
| <br>
+
| <br>
+
| <br>
+
| <br>
+
|-
+
| bgcolor="#cccccc" | ''Conversion Matrix 3''
+
| <br>
+
| <br>
+
| <br>
+
| <br>
+
|-
+
| bgcolor="#cccccc" | ''Conversion Matrix 4''
+
| <br>
+
| <br>
+
| <br>
+
| <br>
+
|-
+
| bgcolor="#cccccc" | ''Conversion Matrix 5''
+
| <br>
+
| <br>
+
| <br>
+
| <br>
+
|-
+
| bgcolor="#cccccc" | ''Conversion Matrix 6''
+
| <br>
+
| <br>
+
| <br>
+
| <br>
+
|-
+
| bgcolor="#cccccc" | ''Conversion Matrix 7''
+
| <br>
+
| <br>
+
| <br>
+
| <br>
+
|}
+
 
+
'''Notes on Table 7'''
+
 
+
#We'll document error conditions of conversions, and their resulting exceptions. Whenever possible this documentation will be comments in the EGL source file for a type. <br>
+
#Booleans convert to strings as "true" or "false" (lowercase).<br>
+
#Strings convert to/from timestamps: the string is parsed, fields come from the timestamp's declaration, we'll pick a format...no conversion to timestamp w/o pattern allowed because it's ambiguous.<br>
+
#Strings convert to/from numbers using our literal syntax for numbers.<br>
+
#Strings convert to bytes using the bit pattern of the Unicode characters in the string.<br>
+
#All numeric types are compatible with each other, but some conversions can result in overflow or truncation.<br>
+
#Numeric types convert to/from bytes using the number's bit pattern.&nbsp; When the bytes type includes a size (i.e. "bytes(4)" not just "bytes") the conversion is legal only if the size of the number in bytes equals the length of the bytes type.<br>
+
 
+
<br>
+
 
+
{| cellspacing="1" cellpadding="1" border="1"
+
|+
+
'''Conversion Matrix''' (rows = from type, columns = to type)<br>
+
 
+
|-
+
| <br>
+
| bigint<br>
+
| boolean<br>
+
| bytes<br>
+
| decimal<br>
+
| float<br>
+
| int<br>
+
| number<br>
+
| smallfloat<br>
+
| smallint<br>
+
| string<br>
+
| timestamp<br>
+
|-
+
| bigint<br>
+
| align="center" | -<br>
+
| align="center" | <br>
+
| align="center" | 7<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 4<br>
+
| align="center" | <br>
+
|-
+
| boolean<br>
+
| align="center" | <br>
+
| align="center" | -<br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | 2<br>
+
| align="center" | <br>
+
|-
+
| bytes<br>
+
| align="center" | 7<br>
+
| align="center" | <br>
+
| align="center" | -<br>
+
| align="center" | 7<br>
+
| align="center" | 7<br>
+
| align="center" | 7<br>
+
| align="center" | 7<br>
+
| align="center" | 7<br>
+
| align="center" | 7<br>
+
| align="center" | <br>
+
| align="center" | <br>
+
|-
+
| decimal<br>
+
| align="center" | 6<br>
+
| align="center" | <br>
+
| align="center" | 7<br>
+
| align="center" | -<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 4<br>
+
| align="center" | <br>
+
|-
+
| float<br>
+
| align="center" | 6<br>
+
| align="center" | <br>
+
| align="center" | 7<br>
+
| align="center" | 6<br>
+
| align="center" | -<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 4<br>
+
| align="center" | <br>
+
|-
+
| int<br>
+
| align="center" | 6<br>
+
| align="center" | <br>
+
| align="center" | 7<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | -<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 4<br>
+
| align="center" | <br>
+
|-
+
| number<br>
+
| align="center" | 6<br>
+
| align="center" | <br>
+
| align="center" | 7<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | -<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 4<br>
+
| align="center" | <br>
+
|-
+
| smallfloat<br>
+
| align="center" | 6<br>
+
| align="center" | <br>
+
| align="center" | 7<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | -<br>
+
| align="center" | 6<br>
+
| align="center" | 4<br>
+
| align="center" | <br>
+
|-
+
| smallint<br>
+
| align="center" | 6<br>
+
| align="center" | <br>
+
| align="center" | 7<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | 6<br>
+
| align="center" | -<br>
+
| align="center" | 4<br>
+
| align="center" | <br>
+
|-
+
| string<br>
+
| align="center" | 4<br>
+
| align="center" | <br>
+
| align="center" | 5<br>
+
| align="center" | 4<br>
+
| align="center" | 4<br>
+
| align="center" | 4<br>
+
| align="center" | 4<br>
+
| align="center" | 4<br>
+
| align="center" | 4<br>
+
| align="center" | -<br>
+
| align="center" | 3<br>
+
|-
+
| timestamp<br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | <br>
+
| align="center" | 3<br>
+
| align="center" | -<br>
+
|}
+
 
+
 
+
 
+
<br>
+
  
 
== What's left...  ==
 
== What's left...  ==

Revision as of 07:58, 7 July 2011

General Notes

  • This document is not finished yet! It's being populated from the design meetings. Design meeting notes are at EDT:Discussion topics from the language meetings.
  • "N/S" means Not Supported.
  • Anything that exists in RBD but isn't mentioned here is not included in EDT. Or maybe we forgot about it. Nobody's perfect.
  • The work in the Core category includes the parser, model, and validation.
  • The work in the JavaScript, Java, and Debug categories includes both the generator and runtime.
  • Text with an orange background shows differences in features supported by both EDT and RBD.
  • Developers: include a link to Bugzilla for features not done yet, and mark items "Done" when you're finished.

Part Types (Table 1)

Part Types Core JavaScript Java Debug
DataItem1



Function2, 5



Top-level function2, 5



Delegate2



Record




Structured Record

N/S N/S N/S
ExternalType




Handler




Library




Service




Interface3




Enumeration




Program4

N/S


Array




Nullability6




DataTable

N/S N/S N/S
Form

N/S N/S N/S

Notes on Table 1

  1. In RBD a DataItem can only be used for primitive types. In EDT it can be used for any type.
  2. See also Table 2: Function Parameters.
  3. Interfaces can be implemented by services and handlers (every kind of "logic part" which can be instantiated).
  4. There are no called programs in EDT. Use libraries for "local calls" and services for "remote calls".
  5. We intend to support function overloading in all implementations, even JavaScript.
  6. Nullability means that a variable may really be null. It's not an "I'm null" flag like in RBD. A NullValueException will be thrown if you try to access a field or function of a null variable, even a record. A NullValueException will be thrown if a null variable is an operand to a math operator, an array access, a substring access, a comparison, or a bitwise operator. The string concatenation operators will work the same as in RBD with respect to nulls.  :: treats null as the empty string, and ?: results in null if either operand is null. A question mark won't be allowed on the second operand of the AS and ISA operators (the name of the type).

Function Parameters (Table 2)

Function Parameters Core JavaScript Java Debug
In1



Out



Inout1



Ellipsis



Const



Field

N/S N/S N/S
SqlNullable

N/S N/S N/S

Notes on Table 2

  1. The default parameter modifier is In for references and Inout for values.

Primitive Types (Table 3)

Primitive Types Core JavaScript Java Debug
Any



Boolean



Dictionary



String(N)1



String2



Timestamp3



Blob
N/S


Clob
N/S


Smallint



Int



Bigint



Decimal(N,M)



Decimal(N)



Decimal4



Float



Smallfloat



Number5



Bytes(N)6



Bytes7



Arraydictionary

N/S N/S N/S
Char

N/S N/S N/S
Dbchar

N/S N/S N/S
Mbchar

N/S N/S N/S
Unicode

N/S N/S N/S
Hex6

N/S N/S N/S
Date3

N/S N/S N/S
Time3

N/S N/S N/S
Interval3

N/S N/S N/S
Bin

N/S N/S N/S
Num

N/S N/S N/S
Numc

N/S N/S N/S
Pacf

N/S N/S N/S
Money

N/S N/S N/S

Notes on Table 3

  1. String(N) is a reference type in EDT.
  2. String is a reference type in EDT.
  3. Timestamp is the only supported date/time type. Use it in place of RBD's date, time, and interval.
  4. Decimal with no length or decimals is a reference type with an immutable value.
  5. Number is a reference type with an immutable value. Unlike in RBD, number variables can be declared anywhere a variable declaration is allowed.
  6. Bytes(N) is a value type similar to RBD's hex. N indicates the number of bytes in the value. (In RBD, the length of a hex is the number of nibbles not the nubmer of bytes.)
  7. Bytes with no length is a reference type with an immutable value of any length.

Conversions Between Primitive Types (Table 4)

Conversion Matrix

Rows = from type, columns = to type


bigint
boolean
bytes
decimal
float
  int 
number
smallfloat
smallint
string
timestamp
bigint
a

g
f
f
f
f
f
f
d

boolean

a







b

bytes
g

a
g
g
g
g
g
g


decimal
f

g
a
f
f
f
f
f
d

float
f

g
f
a
f
f
f
f
d

int
f

g
f
f
a
f
f
f
d

number
f

g
f
f
f
a
f
f
d

smallfloat
f

g
f
f
f
f
a
f
d

smallint
f

g
f
f
f
f
f
a
d

string
d

e
d
d
d
d
d
d
a
c
timestamp









c
a

blank = conversion not supported

a = Same types (not a conversion)

b = Booleans convert to strings as "true" or "false" (lowercase).

c = Strings convert to/from timestamps: the string is parsed, fields come from the timestamp's declaration, we'll pick a format...no conversion to timestamp w/o pattern allowed because it's ambiguous.

d = Strings convert to/from numbers using our literal syntax for numbers.

e = Strings convert to bytes using the bit pattern of the Unicode characters in the string.

f = All numeric types are compatible with each other, but some conversions can result in overflow or truncation.

g = Numeric types convert to/from bytes using the number's bit pattern. When the bytes type includes a size (i.e. "bytes(4)" not just "bytes") the conversion is legal only if the size of the number in bytes equals the length of the bytes type.


Conversions Between Primitive Types1 Core JavaScript Java Debug
Any to everything



Everything to any



Conversion Matrix b



Conversion Matrix c



Conversion Matrix d



Conversion Matrix e



Conversion Matrix f



Conversion Matrix g



Notes on Table 4

  1. We'll document error conditions of conversions, and their resulting exceptions. Whenever possible this documentation will be comments in the EGL source file for a type.

Statements (Table 5)

Statements Core JavaScript Java Debug
Variable declaration5



Const declaration



Assignment



Move1



Return



Function invocation



Call2



Label



Transfer
N/S


Throw



Try



Case



If



While



For



Foreach3



Exit



Continue



Empty statement (a semicolon)



Add
N/S


Close
N/S


Delete
N/S


Get
N/S


Replace
N/S


Execute4
N/S


Prepare4
N/S


Open4
N/S


FreeSQL4
N/S


Goto

N/S N/S N/S
Set

N/S N/S N/S
Converse

N/S N/S N/S
Display

N/S N/S N/S
Print

N/S N/S N/S
Forward

N/S N/S N/S
Show

N/S N/S N/S
OpenUI

N/S N/S N/S

Notes on Table 5

  1. EDT won't support every variation of RBD's move statement. There will be support for move byName, move for, and move for all. A move statement without one of the additional keywords is only allowed between two references, and it results in the target being assigned a copy of the source's value. If/when we support structured records, we might not support move byName on them because of the complex (unclean) design.
  2. EDT doesn't have called programs, but services and native programs can be called.
  3. EDT's foreach statement will support iterating over an array.
  4. Support for these statements is tentative, pending the design for JPA in EDT.
  5. New syntax will allow setting annotations on declarations without the use of curly braces. In RBD we usually do x int {myAnnotation = 3}; but another way to do the same thing is x int {@myAnnotation{3}};. In EDT we will allow that to be outside of curly braces and before the declaration, for example @myAnnotation{3} x int;.


Literals (Table 6)

Literals Core JavaScript Java Debug
null



boolean1



integer2



fixed-decimal3



floating point



string4



bytes5



array



char
N/S N/S N/S
mbchar
N/S N/S N/S
dbchar
N/S N/S N/S
hex
N/S N/S N/S

Notes on Table 6

  1. As in RBD, there are four boolean literals: true false yes no
  2. Integer literals have 1-32 digits, an optional leading sign, and no decimal point. The type of the literal depends on the value. If the value fits in a smallint, then the type is smallint. If the value doesn't fit in a smallint but it does fit in an int, then the type is int. Similarly for bigint. If the value is too large for a bigint, then the type is decimal(X), where X is the number of digits in the value.
  3. Fixed-decimal literals have 1-32 digits, an optional leading sign, and a decimal point. At least one digit must follow the decimal point, but it's permissible to have no digits before the decimal point. The type of a fixed-decimal literal is decimal(X,Y), where X is the total number of digits and Y is the number of digits to the right of the decimal point.
  4. String literals are enclosed in double quotes. An optional ux prefix may appear before the opening double quote. The ux prefix means the string is defined as Unicode codepoints in hexadecimal. For example "012" and ux"003000310032" have the same value. The letters u and x may be in any case.
  5. A bytes literal is written as 0x or 0X followed by an even number of hexadecimal digits. For example 0x03AB is a literal whose type is bytes(2).

Operators and expressions (Table 7)

Operators and expressions1 Core JavaScript Java Debug
. (member access)



=



function invocation



new



{ } (set-values block)



@



[ ] (array access)



[ ] (dynamic access)



[ ] (substring)2



isa3



as3



unary (+ - ! ~)4, 5



math (+ - * / % **)9



assigning math (+= -= *= /= %= **=)9



::



?:



logical (And Or && ||)



comparison (< > <= >= == !=)



bitwise (& | Xor << >> >>>)4, 5



assigning bitwise (&= |= Xor= <<= >>= >>>=)4, 5



if-then-else (condition ? val1 : val2)6



in7
N/S N/S N/S
like matches8
N/S N/S N/S

Notes on Table 7

  1. We'll document error conditions of operators and expressions, and their resulting exceptions. Whenever possible this documentation will be comments in the EGL source file for a type.
  2. Substrings are immutable, so they can't be the target of an assignment or the argument to an inout parameter.
  3. The type cannot be a nullable type. Nullability is not part of a type signature.
  4. There are new bitwise operators in EDT. ~ is a bitwise NOT (also called the compliment), << is a left shift, >> is a right shift where the leftmost bits become zero, >>> is a right shift where the sign is copied into the leftmost bits.
  5. Bitwise operators are only supported on int, bigint, and smallint.
  6. The if-then-else operator is borrowed from languages like C and Java. The condition's type must be boolean. The two values must have the same type.
  7. We'll have functions in the array type to provide similar behavior.
  8. We'll have functions in the string type to provide similar behavior.
  9. Date/time math is not supported in EDT. Functions on the timestamp type provide similar behavior.



What's left...

  • Stereotypes
    • program stereotypes
      • BasicProgram
      • UIProgram
      • TextUIProgram
      • VGWebTransaction
    • library stereotypes
      • BasicLibrary
      • NativeLibrary
      • RUIPropertiesLibrary
    • record stereotypes
      • BasicRecord
      • Exception
      • SQLRecord
      • CSVRecord
      • DLISegment
      • PSBRecord
      • IndexedRecord
      • RelativeRecord
      • SerialRecord
      • MQRecord
      • ConsoleForm
      • VGUIRecord
    • handler stereotypes
      • BasicHandler
      • RUIHandler
      • RUIWidget
      • BirtHandler
      • JasperReport
      • JSFHandler
    • externaltype stereotypes
      • NativeType
      • JavaObject
      • JavaScriptObject
      • HostProgram
    • datatable stereotypes...form stereotypes...
  • Annotations (details TBD)
  • Our libraries and functions within our types (details TBD)
  • Language compliance test (details TBD)


Back to the top