Can we drop static struct initializers?

dsimcha dsimcha at yahoo.com
Sat Nov 21 12:36:07 PST 2009


== Quote from retard (re at tard.com.invalid)'s article
> Sat, 21 Nov 2009 21:49:21 +0200, Max Samukha wrote:
> > On Sat, 21 Nov 2009 18:51:40 +0000 (UTC), dsimcha <dsimcha at yahoo.com>
> > wrote:
> >
> >>== Quote from Max Samukha (spambox at d-coding.com)'s article
> >>> On Fri, 20 Nov 2009 15:30:48 -0800, Walter Bright
> >>> <newshound1 at digitalmars.com> wrote:
> >>> >Yigal Chripun wrote:
> >>> >> what about foreach_reverse ?
> >>> >
> >>> >No love for foreach_reverse? <tear>
> >>> And no mercy for opApply
> >>
> >>opApply **must** be kept!!!!  It's how my parallel foreach loop works.
> >>This would be **impossible** to implement with ranges.  If opApply is
> >>removed now, I will fork the language over it.
> >
> > I guess it is possible:
> >
> > uint[] numbers = new uint[1_000];
> >
> > pool.parallel_each!((size_t i){
> >         numbers[i] = i;
> >     })(iota(0, numbers.length));
> >
> > Though I agree it's not as cute but it is faster since the delegate is
> > called directly. Or did I miss something?
> Sorry for asking this stupid question but why was 'iota' chosen for that
> purpose? I was kind of expecting that D2 would have these extension
> methods which would allow writing '0.to(numbers.length)' by defining
> 'auto to(int begin, int end) { ... }'. I looked at wikipedia (http://
> en.wikipedia.org/wiki/Iota) and they seem to give credit for the Go
> programming language which seems rather weird since they probably existed
> in D long before Go was released. I've never heard of this APL being used
> anywhere.

Because parallel foreach works over arbitrary ranges (though somewhat
inefficiently over non-random access ranges) and iota is what's implemented now,
so that's what I used in my examples.  If we get extension methos and
0.to(numbers.length) returns a random access range of integers [0, numbers.length)
, then this will work, too.



More information about the Digitalmars-d mailing list