Can we get rid of opApply?

Fawzi Mohamed fmohamed at mac.com
Tue Jan 20 07:07:21 PST 2009


I think that opApply should stay

1) range (iterators, whatever) hide the iteration step, this allows to 
iterate several of them in lockstep (nice)

2) opApply hides the iteration loop this allows one to make parallel 
loops (nice)

I have successfully used opApply as follow

auto a=zeros([100,100]);
foreach (ref i;a.pLoop){
  i+=4+i;
}

This can be dangerous (the loop content cannot have non synchronized 
sequential dependencies), but I find it quite nice...

So I think that both solutions have their place.

Fawzi




More information about the Digitalmars-d mailing list