Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355743 - Implement array language changes
Summary: Implement array language changes
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-24 12:31 EDT by Matt Heitz CLA
Modified: 2017-02-23 14:14 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Heitz CLA 2011-08-24 12:31:42 EDT
This work needs to be completed in Iteration 13.  Prioritize it ahead of other
enhancements, even if they'll have to be pushed out of the iteration.

[The following is the section on Array Declarations from
http://wiki.eclipse.org/EDT:EGL_Language_Statements.]


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 };".
Comment 1 Paul Harmon CLA 2011-09-06 08:35:49 EDT
Core changes are complete
Comment 2 Matt Heitz CLA 2011-09-08 13:27:13 EDT
Closing.
Comment 3 Matt Heitz CLA 2011-09-08 13:27:36 EDT
Closing.