OEP

131

Title

Array slice syntax

Summary

Provide a less unusual syntax for array slices.

Owner

Peter Welch

Status

Proposed

Date-Proposed

2006-03-14

Keywords

language array slices

Array slices are currently given using a somewhat unusual syntax:

[array FROM base FOR length]
[array FROM base]
[array FOR length]

To mirror regular array indexing, a syntax like this could be used instead:

array[FROM base FOR length]

This is also slightly easier to parse with a limited-lookahead parser (as occ21 has). Another option, echoing Python and Perl, would be:

array[base .. limit]

These expressions can also be written using regular replicator syntax, but cannot currently be used as lvalues:

[i = base FOR length | array[i]]

OEP/131 (last edited 2007-09-27 00:50:17 by ats1)