A few simple syntactic proposals

Simen Kjaeraas simen.kjaras at gmail.com
Wed Apr 16 19:05:34 PDT 2008


On Thu, 17 Apr 2008 04:01:56 +0200, Jason House  
<jason.james.house at gmail.com> wrote:

> Robert Fraser wrote:
>> Also:
>> Remove the implicit "length" inside slice brackets as it conflicts with
>> outer length. Allow only $.
>
> Can you give an example of this?
>
> are you saying char[] foo = bar[3..length] should be replaced with char[]
> foo = bar[3..$]?  If yes, I don't see how the length is confusing.  If
> you're talking about nested indexing, I'd expect both length and $ to be
> ambiguous.


int length = 4;
int[] foo;

// ...

auto bar = foo[0..length];


will this slice from 0 to foo.length or 0 to 4?

-- Simen



More information about the Digitalmars-d mailing list