Automatic Foreach
terranium
spam at here.lot
Mon Apr 28 01:28:04 PDT 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]);
> >
> This raises an interesting point. So the typesaftly issue could be
> 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[]; }
More information about the Digitalmars-d
mailing list