On Tue, Oct 16, 2012 at 09:05:50PM -0600, Brad Anderson wrote: > On Tue, Oct 16, 2012 at 2:54 PM, H. S. Teoh <[email protected]> wrote: [...] > > So it seems like there is some kind of bad interaction between map > > and joiner. Maybe as jethro said, it's wrong code produced by dmd > > for the delegate passed to map? It seems to be dependent on the > > reference to the local variable C, which seems to imply a corrupted > > (or just out-of-scope?) delegate context. [...] > I'm starting to think maybe I shouldn't have closed my issue I reported > awhile back: > > http://d.puremagic.com/issues/show_bug.cgi?id=7978 > > I really need to read how closures are supposed to work. [...]
Well, closures are *supposed* to give you access to the context of a function that has gone out of scope -- usually implemented by allocating the local variables referenced by the closure on the heap instead of the stack. D is supposed to do this (TDPL, ยง5.8.1, p. 154). If dmd fails to implement this, it's a bug. T -- It won't be covered in the book. The source code has to be useful for something, after all. -- Larry Wall
