foreach and filter

Timon Gehr timon.gehr at gmx.ch
Thu Apr 12 12:12:47 PDT 2012


On 04/12/2012 08:08 PM, Steven Schveighoffer wrote:
> On Thu, 12 Apr 2012 13:44:36 -0400, Timon Gehr <timon.gehr at gmx.ch> 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.
>
> It's implied pure if filter is pure. Templates are auto-pure if all the
> functions they call are pure. array should not be specifically marked pure.
>
> This may be what you meant (i.e. it's not being implied as pure), but I
> want to be clear what it *should* be.
>
> -Steve

Yes, that is what I meant.


More information about the Digitalmars-d mailing list