Re: Improving (foreach) ranges

2011-06-11 Thread eles
> And the multi-dimensional slicing discussions tend to advocate mapping
> a..b to [a,b].

which would be such a shame...


Re: Improving (foreach) ranges

2011-06-09 Thread Robert Jacques
On Thu, 09 Jun 2011 19:58:34 -0400, Andrej Mitrovic  
 wrote:



Yeah there was a big discussion about this IIRC. I can't recall the
exact link to the topic, sorry.


I know one of them was during tuple discussions. i.e. to use a..b..c  
instead of (a,b,c) The principal rational was a) '(,)' already has other  
meanings in D and b) '..' would allow for multi-dimensional slicing. But  
people felt this was ugly.


And the multi-dimensional slicing discussions tend to advocate mapping  
a..b to [a,b].


Re: Improving (foreach) ranges

2011-06-09 Thread Andrej Mitrovic
Yeah there was a big discussion about this IIRC. I can't recall the
exact link to the topic, sorry.


Improving (foreach) ranges

2011-06-09 Thread Robert Clipsham
With the introduction of std.parallelism, I've been wondering about the 
following:


foreach (i; 0..100)
{
}

For most uses of foreach, you can just wrap the range in parallel(), but 
with a foreach range statement you can't do this. Of course iota() could 
be used:


foreach (i; parallel(iota(0, 100)))
{
}

But that seems inconsistent. What are people's thoughts on making the 
syntax a..b more general, so you can do eg:


void foo(int[]);
foo(0..100);

Although, I seem to recall seeing this conversation elsewhere, let me 
know if this is the case.


--
Robert
http://octarineparrot.com/