[Issue 8774] 2.059 worked 2.060 does not: nested delegate memory corruption

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Dec 27 03:26:11 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8774



--- Comment #32 from Russel Winder <russel at winder.org.uk> 2012-12-27 03:25:57 PST ---
(In reply to comment #26)
[…]
> It's not exactly  an iterable or sequence, it's a lazy computation represented
> as a range. The key point is that it doesn't even attempt to store results
> somewhere nor avoid recomputation on demand.

If I can iterate over it then it is iterable ;-)

The real point is lazy evaluation vs. strict evaluation. And the question is,
as stated early: why did this ever work? On the other hand, the code works now. 

[…]

> So... can you print the addresses of threads (in both start & join loops) in
> 2.059 where it used to work. It's intriguing to see if this guess is on spot
> and what forces are at work there.

I will try and look into this in the new year.

[…]
> No, I suspect you are confusing these 2 cases:
> foreach(i; x..y)
> {
>    threads ~= delegate (){ 
>        //use i here
>    }
> }
> 
> vs
> 
> threads = map!( (int i){ use i here ... })(...);

I suspect you are 100% correct :-) Thanks for the "heads up", code duly amended
and still working.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list