opSlice() magic for foreach now works?

spir denis.spir at gmail.com
Wed Mar 30 11:01:41 PDT 2011


On 03/30/2011 05:34 PM, Steven Schveighoffer wrote:
> On Wed, 30 Mar 2011 11:29:02 -0400, spir <denis.spir at gmail.com> wrote:
>
>>
>> Strange, I just tried it on a custom, trivial, collection type --precisely to
>> verify that it does not work only for the standard SList-- and it worked fine
>> (dmd 2.051 on ubuntu). But now I cannot reproduce this success anymore! get
>> the same error as you. Will go on trying and tell you if anything changes.
>>
>> Anyway, if the feature is still unimplemented, why and how does foreach work
>> on SList. ???
>
> It may be partially/poorly implemented. I looked at the disassembly, and it is
> indeed calling opSlice and the range primitives inside the foreach loop.
>
> There is likely a trigger that the compiler uses to determine if it can do
> that, and the trigger is probably incorrectly defined.
>
> I would think (though I'm not a compiler guy) that to fix this should be minor
> since the code generation already works in at least one case. Walter?

Yes, i must have hit this trigger button by pure chance on my first attempt 
(unfortunately, since I was then sure the feature works, i did not keep the 
code, so i cannot compare).

Denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d mailing list