foreach and filter
Jonathan M Davis
jmdavisProg at gmx.com
Thu Apr 12 12:51:12 PDT 2012
On Thursday, April 12, 2012 19:44:36 Timon Gehr wrote:
> On 04/11/2012 06:08 PM, Russel Winder wrote:
> > Doing something along the lines of:
> > const a = array ( filter! ... ) ;
> > foreach ( i ; a ) { ... }
> >
> > works fine. Question 1 though is why I can't use immutable here, why I
> > have to use const.
>
> 'array' is not pure for some reason. This should be fixed.
Probably a result of various array-related stuff which should be pure but isn't
(e.g. Appender and some of what's in object_.d), but I'd have to go dig
through the implementation to see. We have some pull requests though that
should improve that situation for 2.060, and a number of them _must_ be sorted
out for 2.060, because we're looking at making toString pure, and too many
string-related functions (particularly format, text, and to) can't be pure yet
for that to work.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list