foreach/iota countdown

Francesco Cattoglio francesco.cattoglio at gmail.com
Mon Feb 17 16:01:42 PST 2014


On Monday, 17 February 2014 at 20:21:30 UTC, simendsjo wrote:
> I wouldn't call it randomly. In that case you should call it 
> randomly that it suddenly doesn't run once you try to step 
> downward.

I didn't had time to work more on the iota. Perhaps after 2.065 
is out I can resume working on that, but I'm really short of time 
right now.

Allowing iota to iterate downward might become a horrible idea 
when we finally extend iota to other non-numeric types.
The big issue is that types that define both opUnary!"++" and 
opUnary!"--" would behave in a completely different way from 
types that only define opUnary!"++".

from 
http://forum.dlang.org/thread/mwwznnobgecnwermrndq@forum.dlang.org
example:
type T implements ++t and --t;
type P only implements ++p;
t1 < t2 => iota(t2, t1) has a way to compute a non-empty range;
p1 < p2 => iota(p2, p1) can do nothing but return an empty range;

This really looks like a minefield to me.


More information about the Digitalmars-d-learn mailing list