--- Comment #6 from Denis Derman <> 2011-02-12 23:35:51 PST 
(In reply to comment #3)
> Michel Fortin:
> > how do you rewrite this using the new proposed syntax:
> >
> >         auto aa = [iota(a, b, c): 1, iota(d, e): 2];

I like the proposal by Andrej Mitrovic on the mailing list:

But maybe we could extend the array slice syntax to construct [iota] ranges:

filter!`a % 2 == 0`([1..5])
auto r = [0 .. 5];

So if the slice sits on its own it becomes a range. Or is this too

I don't really like them alone:
filter!`a % 2 == 0`(1..5)
auto r = 0 .. 5;

My comment:

This means basically, for slicing:
   (array expression)~(interval notation) ==> slice operation
This also allows noting a step without any syntax problem:
Finally, as noted by someone, this allows reinterpreting slicing as a special
case of indexing, possibly unifying metamethods opIndex & opSlice, and opening
the door to easier custom rules like multi-dimensional semantics.

The issue is indeed this syntax conflicts with current:
    foreach (n ; i..j)
Too bad we have not had this form from the start...


Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to