Array creation expressions

Sather - Language Specification
Prev | Chapter 7. Basic Expressions | Next

# 7.8. Array creation expressions

Example 7-10. Examples:

    |2,4,6,8|
    |"apple", "orange", "cherry", "kiwi"|

    array_expression ==>
            | expression_list |

    expression_list ==>
            expression { , expression }

Array creation expressions are used to create and directly specify the elements of an array object. The type is taken to be the declared type of the context in which it appears and it must be ARRAY{T} for some type T. An array creation expression may not appear as the right hand side of a '::=' assignment (See Assignment statements), as a method argument in which the overloading resolution is ambiguous, or as the left argument of the dot '.' operator (See Method call expressions). The types of each expression in the expression_list must be subtypes of T. The size of the created array is equal to the number of specified expressions. The expressions are evaluated left to right and the results are assigned to successive array elements.

Prev | Home | Next
Creation expressions | Up | and expressions