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 Statements"

 
(41 intermediate revisions by 7 users not shown)
Line 1: Line 1:
 
Please see the parent of this page, [[EDT:EGL Language]].  
 
Please see the parent of this page, [[EDT:EGL Language]].  
 +
 +
<br>
  
 
== Statements (Table 5)  ==
 
== Statements (Table 5)  ==
  
{| cellspacing="1" cellpadding="1" border="1" width="400" style=""
+
{| cellspacing="1" cellpadding="1" border="1" style="width: 903px; height: 1543px;"
 
|-
 
|-
 
| bgcolor="#999999" align="center" | '''''Statements'''''  
 
| bgcolor="#999999" align="center" | '''''Statements'''''  
Line 10: Line 12:
 
| bgcolor="#999999" align="center" | '''Java'''
 
| bgcolor="#999999" align="center" | '''Java'''
 
|-
 
|-
| bgcolor="#cccccc" | ''Variable declaration<sup>5</sup>''  
+
| bgcolor="#cccccc" | ''Variable declaration (including nullability<sup>6</sup> and array declarations<sup>7</sup>)''<br>
| <br>  
+
| <br>done
| <br>  
+
| done<br>  
| <br>
+
| done<br>
 +
|-
 +
| bgcolor="#ffff00" | ''Annotations before declarations<sup>4</sup>''
 +
| bgcolor="#ffff00" | 6d
 +
| bgcolor="#ffff00" | none
 +
| bgcolor="#ffff00" | none
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Const declaration''  
 
| bgcolor="#cccccc" | ''Const declaration''  
 +
| <br>done
 +
| done<br>
 +
| done<br>
 +
|-
 +
| bgcolor="#cccccc" | ''Use''
 
| <br>  
 
| <br>  
| <br>  
+
| done<br>  
| <br>
+
| done<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Assignment''  
 
| bgcolor="#cccccc" | ''Assignment''  
| <br>
 
 
| done<br>  
 
| done<br>  
| <br>
+
| done<br>
 +
| done<br>
 
|-
 
|-
| bgcolor="#cccccc" | ''Move<sup>1</sup>''  
+
| bgcolor="#ffff00" | ''Move<sup>1</sup>''  
| <br>  
+
| bgcolor="#ffff00" | <br>done {{bug|354164}}
| <br>  
+
| bgcolor="#ffff00" | 2d<br>  
| <br>
+
| bgcolor="#ffff00" | 2d {{bug|353670}}<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Return''  
 
| bgcolor="#cccccc" | ''Return''  
| <br>  
+
| <br>done
| [https://bugs.eclipse.org/bugs/show_bug.cgi?id=352141 JS:Functions, Return]<br>  
+
| done<br>(see Function invocation below)<br>  
| <br>
+
| done<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Function invocation''  
 
| bgcolor="#cccccc" | ''Function invocation''  
| <br>  
+
| <br>done
 
|  
 
|  
[https://bugs.eclipse.org/bugs/show_bug.cgi?id=352141 JS: Functions, Return]
+
done<br><br>Synchronous service invocation
  
Synchronous service invocation<br>  
+
<br>  
  
 
|  
 
|  
 
REST Service invocation<br>  
 
REST Service invocation<br>  
  
*{{XML Conversion|351892}}<br>  
+
<br>
*JSON Conversion<br>  
+
 
*invocation gen/rt<br>SOAP Service invocation<br>
+
*XML Conversion {{bug|351892}}(3d)<br>
 +
 
 +
*<strike>JSON Conversion {{bug|352581}}(3d)</strike><br>
 +
 
 +
*invocation gen/rt {{bug|352588}}(10d)
 +
 
 +
<span style="background: none repeat scroll 0% 0% rgb(255, 255, 0);">SOAP Service invocation {{bug|352590}}(3d)</span>
 +
 
 +
<br>  
  
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Call<sup>2</sup>''  
 
| bgcolor="#cccccc" | ''Call<sup>2</sup>''  
| <br>  
+
| <br>done
 
|  
 
|  
 
REST Service invocation  
 
REST Service invocation  
  
*XML Conversion{{bug|346138}}
+
<br>  
*{{JSON Conversion|346144}}
+
*{{invocation gen/rt|346144}}<br>
+
  
SOAP Service invocation<br>Dedicated service invocation<br>{{Proxy|346145}}<br>
+
*XML Conversion {{bug|346138}}(3d)
  
| <br>
+
*JSON Conversion {{bug|346144}}(1d)
 +
 
 +
*invocation gen/rt {{bug|346144}}(2d)<br>
 +
 
 +
<span style="background: none repeat scroll 0% 0% rgb(255, 255, 0);">SOAP Service invocation {{bug|352591}}(3d)</span><br>Dedicated service invocation {{bug|352592}}(3d)<br>Proxy {{bug|346145}}(1d)<br>
 +
 
 +
<br>
 +
 
 +
| <span style="background: none repeat scroll 0% 0% rgb(255, 255, 0);">5d {{bug|353672}}</span><br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Label''  
 
| bgcolor="#cccccc" | ''Label''  
| <br>
 
 
| done<br>  
 
| done<br>  
| <br>
+
| done<br>
 +
| done<br>
 
|-
 
|-
| bgcolor="#cccccc" | ''Transfer''  
+
| bgcolor="#ffff00" | ''Transfer''  
| <br>  
+
| bgcolor="#ffff00" | <br>done
| N/S<br>  
+
| bgcolor="#ffff00" | N/S<br>  
| <br>
+
| bgcolor="#ffff00" | 1d<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Throw''  
 
| bgcolor="#cccccc" | ''Throw''  
| <br>  
+
| <br>done
| [https://bugs.eclipse.org/bugs/show_bug.cgi?id=352140 JS:Throws]<br>  
+
| done<br>  
| <br>
+
| done<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Try''  
 
| bgcolor="#cccccc" | ''Try''  
| <br>
 
 
| done<br>  
 
| done<br>  
| <br>
+
| done<br>  
|-
+
| done<br>
| bgcolor="#cccccc" | ''Catch''
+
| <br>  
+
| done  
+
| {{bug|346144}}<br>
+
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Case''  
 
| bgcolor="#cccccc" | ''Case''  
| <br>  
+
| <br>done
| [https://bugs.eclipse.org/bugs/show_bug.cgi?id=352031 JS: Case]<br>  
+
| done<br>  
| <br>
+
| (preprocessor doesn't pass case statement, it breaks into a series of IF statements) - no work needed<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''If''  
 
| bgcolor="#cccccc" | ''If''  
| <br>  
+
| <br>done
| [https://bugs.eclipse.org/bugs/show_bug.cgi?id=352028 JS: If ]<br>  
+
| done<br>  
| <br>
+
| done<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''While''  
 
| bgcolor="#cccccc" | ''While''  
| <br>  
+
| done<br>  
| [https://bugs.eclipse.org/bugs/show_bug.cgi?id=352029 JS: While]<br>
+
| done
| <br>
+
| done<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''For''  
 
| bgcolor="#cccccc" | ''For''  
| <br>  
+
| done<br>  
| [https://bugs.eclipse.org/bugs/show_bug.cgi?id=352030 JS:For]<br>  
+
| done<br>  
| <br>
+
| done<br>
 
|-
 
|-
| bgcolor="#cccccc" | ''Foreach<sup>3</sup>''  
+
| bgcolor="#cccccc" | ''Foreach (SQL)''  
| <br>
+
| done
| [https://bugs.eclipse.org/bugs/show_bug.cgi?id=352030 JS: Foreach]<br>
+
| N/S
| <br>
+
| 0.5d {{bug|353671}}
 
|-
 
|-
| bgcolor="#cccccc" | ''Exit''  
+
| bgcolor="#ffff00" | ''Foreach (array)<sup>3</sup>''
| <br>  
+
| bgcolor="#ffff00" | done {{bug|366884}}<br>
 +
| bgcolor="#ffff00" | [https://bugs.eclipse.org/bugs/show_bug.cgi?id=352030 JS: Foreach]0.1d<br>
 +
| bgcolor="#ffff00" | 0.5d {{bug|366883}}<br>
 +
|-
 +
| bgcolor="#cccccc" | ''Exit<sup>5</sup>''  
 +
| <br>done
 
| done<br>  
 
| done<br>  
| <br>
+
| done<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Continue''  
 
| bgcolor="#cccccc" | ''Continue''  
| <br>  
+
| <br>done
| [https://bugs.eclipse.org/bugs/show_bug.cgi?id=352139 JS: Continue]<br>  
+
| <br><strike></strike>done<br>  
| <br>
+
| done<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Empty statement (a semicolon)''  
 
| bgcolor="#cccccc" | ''Empty statement (a semicolon)''  
| <br>
 
 
| done<br>  
 
| done<br>  
| <br>
+
| done<br>
 +
| done<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Add''  
 
| bgcolor="#cccccc" | ''Add''  
| <br>  
+
| done<br>  
 
| N/S<br>  
 
| N/S<br>  
| <br>
+
| 1d {{bug|353671}}<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Close''  
 
| bgcolor="#cccccc" | ''Close''  
| <br>  
+
| done<br>  
 
| N/S<br>  
 
| N/S<br>  
| <br>
+
| 0.5d {{bug|353671}}<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Delete''  
 
| bgcolor="#cccccc" | ''Delete''  
| <br>  
+
| <br>done
 
| N/S<br>  
 
| N/S<br>  
| <br>
+
| 1d {{bug|353671}}<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Get''  
 
| bgcolor="#cccccc" | ''Get''  
| <br>  
+
| done<br>  
 
| N/S<br>  
 
| N/S<br>  
| <br>
+
| 2d {{bug|353671}}<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Replace''  
 
| bgcolor="#cccccc" | ''Replace''  
| <br>  
+
| <br>done
 
| N/S<br>  
 
| N/S<br>  
| <br>
+
| 2d {{bug|353671}}<br>
 
|-
 
|-
| bgcolor="#cccccc" | ''Execute<sup>4</sup>''  
+
| bgcolor="#cccccc" | ''Execute''  
| <br>  
+
| done?<br>  
 
| N/S<br>  
 
| N/S<br>  
| <br>
+
| 1d {{bug|353671}}<br>
 
|-
 
|-
| bgcolor="#cccccc" | ''Prepare<sup>4</sup>''  
+
| bgcolor="#cccccc" | ''Prepare''  
| <br>  
+
| done<br>  
 
| N/S<br>  
 
| N/S<br>  
| <br>
+
| done<br>
 
|-
 
|-
| bgcolor="#cccccc" | ''Open<sup>4</sup>''  
+
| bgcolor="#cccccc" | ''Open''  
| <br>  
+
| <br>done?
 
| N/S<br>  
 
| N/S<br>  
| <br>
+
| 2d {{bug|353671}}<br>
 
|-
 
|-
| bgcolor="#cccccc" | ''FreeSQL<sup>4</sup>''  
+
| bgcolor="#ffff00" | ''FreeSQL''  
| <br>  
+
| bgcolor="#ffff00" | <br>done?
| N/S<br>  
+
| bgcolor="#ffff00" | N/S<br>  
| <br>
+
| bgcolor="#ffff00" | 0.5d<br>
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Goto''<br>  
 
| bgcolor="#cccccc" | ''Goto''<br>  
| <br>  
+
| <br>done
 
| N/S  
 
| N/S  
 
| N/S
 
| N/S
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Set''<br>  
 
| bgcolor="#cccccc" | ''Set''<br>  
| <br>  
+
| <br>done
 
| N/S  
 
| N/S  
 
| N/S
 
| N/S
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Converse''<br>  
 
| bgcolor="#cccccc" | ''Converse''<br>  
| <br>  
+
| done<br>  
 
| N/S  
 
| N/S  
 
| N/S
 
| N/S
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Display''<br>  
 
| bgcolor="#cccccc" | ''Display''<br>  
| <br>  
+
| done<br>  
 
| N/S  
 
| N/S  
 
| N/S
 
| N/S
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Print''<br>  
 
| bgcolor="#cccccc" | ''Print''<br>  
| <br>  
+
| done<br>  
 
| N/S  
 
| N/S  
 
| N/S
 
| N/S
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Forward''<br>  
 
| bgcolor="#cccccc" | ''Forward''<br>  
| <br>  
+
| <br>done
 
| N/S  
 
| N/S  
 
| N/S
 
| N/S
 
|-
 
|-
 
| bgcolor="#cccccc" | ''Show''<br>  
 
| bgcolor="#cccccc" | ''Show''<br>  
| <br>  
+
| <br>done
 
| N/S  
 
| N/S  
 
| N/S
 
| N/S
 
|-
 
|-
 
| bgcolor="#cccccc" | ''OpenUI''<br>  
 
| bgcolor="#cccccc" | ''OpenUI''<br>  
| <br>  
+
| <br>done
 
| N/S  
 
| N/S  
 
| N/S
 
| N/S
Line 216: Line 242:
 
'''Notes on Table 5'''<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.  
+
<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 reference variables of the same type, and it results in the target being assigned a deep copy of the source's value. The deep copy is invalid for JavaObject and JavaScriptObject ExternalTypes. If/when we support structured records, we might not support '''move byName''' on them because of the complex (unclean) design.  
 
#EDT doesn't have called programs, but services and native programs can be called.  
 
#EDT doesn't have called programs, but services and native programs can be called.  
 
#<span style="background: none repeat scroll 0% 0% rgb(255, 165, 0);">EDT's foreach statement will support iterating over an array.</span>  
 
#<span style="background: none repeat scroll 0% 0% rgb(255, 165, 0);">EDT's foreach statement will support iterating over an array.</span>  
#Support for these statements is tentative, pending the design for JPA in EDT.
+
#New syntax will allow setting annotations on declarations without the use of curly braces. In RBD we usually do '''<span style="font-family: times,'times new roman',serif;">x int {myAnnotation = 3};</span>''' but another way to do the same thing is '''<span style="font-family: times,'times new roman',serif;">x int {@myAnnotation{3}};</span>'''. In EDT we will allow that to be outside of curly braces and before the declaration, for example '''<span style="font-family: times,'times new roman',serif;">@myAnnotation{3} x int;</span>'''.  
#New syntax will allow setting annotations on declarations without the use of curly braces. In RBD we usually do '''<span style="font-family: times,'Times New Roman',serif;">x int {myAnnotation = 3};</span>''' but another way to do the same thing is '''<span style="font-family: times,'Times New Roman',serif;">x int {@myAnnotation{3}};</span>'''. In EDT we will allow that to be outside of curly braces and before the declaration, for example '''<span style="font-family: times,'Times New Roman',serif;">@myAnnotation{3} x int;</span>'''.
+
#EDT won't support '''exit stack'''.
 +
#See the discussion of nullability below.<br>
 +
#See the discussion of array declarations below.<br>
 +
 
 +
<br>
 +
 
 +
<br>
 +
 
 +
=== Nullability<br>  ===
 +
 
 +
Variable declarations, function parameters, and function return types may end with a question mark to indicate that they're nullable. <span style="background: none repeat scroll 0% 0% rgb(255, 165, 0);">Nullability means that a variable may really be null. It's not an "I'm null" flag like in RBD.&nbsp; Even reference variables can be nullable.</span><br>
 +
 
 +
<br> <span style="background: none repeat scroll 0% 0% rgb(255, 165, 0);">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: none repeat scroll 0% 0% rgb(255, 165, 0);">A question mark won't be allowed on the second operand of the AS and ISA operators (the name of the type).</span><br>
 +
 
 +
<br> <span style="background: none repeat scroll 0% 0% rgb(255, 165, 0);">A validation check will ensure that things which can't be instantiated (interfaces, and types with private default constructors) must be declared nullable. Constructors can be defined in ExternalTypes and handlers.</span>
 +
 
 +
<br> <span style="background: none repeat scroll 0% 0% rgb(255, 165, 0);">You can't assign null to something that's not nullable.&nbsp; We'll give a validation error on notNullableVariable = null; and a runtime error on notNullableVariable = nullableVariable; when the nullableVariable is null.</span><br>
 +
 
 +
<br>
 +
 
 +
=== Array Declarations<br>  ===
 +
 
 +
==== Arrays can't be declared with an initial size  ====
 +
 
 +
<span style="background: none repeat scroll 0% 0% rgb(255, 165, 0);">Arrays can't be declared with an initial size.</span> The size of an array isn't part of its type. That's why in RBD you can declare an int[5] and then assign [1,2,3] to it -- you change its length from 5 to 3. In EDT, all arrays must be declared without an initial size.
 +
 
 +
<br> A size is still allowed on a new expression when you create an array.
 +
 
 +
<br> Here are some example array declarations for EDT:
 +
 
 +
<br>
 +
 
 +
*a int[] = new int[3];
 +
 
 +
*a int[] = [1, 2, 3];
 +
 
 +
*a int[]; // This is an array of length zero.
 +
 
 +
*a int[]?; // Initially null.
 +
 
 +
*a int[]? {}; // This is an array of length zero.
 +
 
 +
==== Initializing arrays with literals  ====
 +
 
 +
Array initializers must be efficient. "a int[] = [1, 2, 3];" means make an array of three elements, values 1 then 2 then 3. Do not make a zero-length array, then make an array from the literal, and throw away the original zero-length array.
 +
 
 +
<br>
 +
 
 +
==== Initializing arrays with set-values blocks  ====
  
<br>
+
<span style="background: none repeat scroll 0% 0% rgb(255, 165, 0);">A set-values block on an array declaration causes the values within the block to be appended to the array. For example "a int[] { 1, 2, 3 };" results in [1, 2, 3].</span> The block has a different effect in RBD: it sets elements rather than appending them, so you'd get an index out of bounds exception on the declaration "a int[] { 1, 2, 3 };".

Latest revision as of 16:31, 4 May 2012

Please see the parent of this page, EDT:EGL Language.


Statements (Table 5)

Statements Core JavaScript Java
Variable declaration (including nullability6 and array declarations7)

done
done
done
Annotations before declarations4 6d none none
Const declaration
done
done
done
Use
done
done
Assignment done
done
done
Move1
done bug 354164
2d
2d bug 353670
Return
done
done
(see Function invocation below)
done
Function invocation
done

done

Synchronous service invocation


REST Service invocation


SOAP Service invocation bug 352590(3d)


Call2
done

REST Service invocation


SOAP Service invocation bug 352591(3d)
Dedicated service invocation bug 352592(3d)
Proxy bug 346145(1d)


5d bug 353672
Label done
done
done
Transfer
done
N/S
1d
Throw
done
done
done
Try done
done
done
Case
done
done
(preprocessor doesn't pass case statement, it breaks into a series of IF statements) - no work needed
If
done
done
done
While done
done done
For done
done
done
Foreach (SQL) done N/S 0.5d bug 353671
Foreach (array)3 done bug 366884
JS: Foreach0.1d
0.5d bug 366883
Exit5
done
done
done
Continue
done

done
done
Empty statement (a semicolon) done
done
done
Add done
N/S
1d bug 353671
Close done
N/S
0.5d bug 353671
Delete
done
N/S
1d bug 353671
Get done
N/S
2d bug 353671
Replace
done
N/S
2d bug 353671
Execute done?
N/S
1d bug 353671
Prepare done
N/S
done
Open
done?
N/S
2d bug 353671
FreeSQL
done?
N/S
0.5d
Goto

done
N/S N/S
Set

done
N/S N/S
Converse
done
N/S N/S
Display
done
N/S N/S
Print
done
N/S N/S
Forward

done
N/S N/S
Show

done
N/S N/S
OpenUI

done
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 reference variables of the same type, and it results in the target being assigned a deep copy of the source's value. The deep copy is invalid for JavaObject and JavaScriptObject ExternalTypes. 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. 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;.
  5. EDT won't support exit stack.
  6. See the discussion of nullability below.
  7. See the discussion of array declarations below.



Nullability

Variable declarations, function parameters, and function return types may end with a question mark to indicate that they're nullable. Nullability means that a variable may really be null. It's not an "I'm null" flag like in RBD.  Even reference variables can be nullable.


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).


A validation check will ensure that things which can't be instantiated (interfaces, and types with private default constructors) must be declared nullable. Constructors can be defined in ExternalTypes and handlers.


You can't assign null to something that's not nullable.  We'll give a validation error on notNullableVariable = null; and a runtime error on notNullableVariable = nullableVariable; when the nullableVariable is null.


Array Declarations

Arrays can't be declared with an initial size

Arrays can't be declared with an initial size. The size of an array isn't part of its type. That's why in RBD you can declare an int[5] and then assign [1,2,3] to it -- you change its length from 5 to 3. In EDT, all arrays must be declared without an initial size.


A size is still allowed on a new expression when you create an array.


Here are some example array declarations for EDT:


  • a int[] = new int[3];
  • a int[] = [1, 2, 3];
  • a int[]; // This is an array of length zero.
  • a int[]?; // Initially null.
  • a int[]? {}; // This is an array of length zero.

Initializing arrays with literals

Array initializers must be efficient. "a int[] = [1, 2, 3];" means make an array of three elements, values 1 then 2 then 3. Do not make a zero-length array, then make an array from the literal, and throw away the original zero-length array.


Initializing arrays with set-values blocks

A set-values block on an array declaration causes the values within the block to be appended to the array. For example "a int[] { 1, 2, 3 };" results in [1, 2, 3]. The block has a different effect in RBD: it sets elements rather than appending them, so you'd get an index out of bounds exception on the declaration "a int[] { 1, 2, 3 };".

Back to the top