On 02/12/2011 10:57 PM, Andrej Mitrovic wrote:
I'd maybe vote for the syntax change.
But maybe we could extend the array slice syntax to construct 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
scary/ambiguous?
I don't really like them alone:
filter!`a % 2 == 0`(1..5)
auto r = 0 .. 5;
I like your idea of [i..j] alone meaning interval. After all, that's exactly
the sense, no? And
(1) it solves the issue of [i..j:step] ambiguity
(2) which may even extend to slices: array[1..$:3]
But it's inconsistent with
foreach (n; i..j) {}
We should have had this syntax from the start, or we face a backward
incompatible change.
I would vote for it, but only because I don't have a big D code base ;-)
Denis
--
_________________
vita es estrany
spir.wikidot.com