digitalmars.D - Re: Automatic Foreach
- terranium <spam here.lot> Apr 28 2008
a[] = n; a[] = b[]; a[] = b[] + c[]; a[] = f(b[]); would mean foreach(ref e;a) e = n; foreach(i,ref e;a) e = b[i]; foreach(i,ref e;a) e = b[i] + c[i]; foreach(i,ref e;a) e = f(b[i]);
solved like: foo(array[]);
This is better but still is too inobvious. How about making it a variant of foreach? foreach a[] = n; foreach a[] = b[]; foreach a[] = b[] + c[]; foreach a[] = f(b[]); foreach { a[] = f(b[]); d[]=b[]+c[]; }
Apr 28 2008