Linked by Thom Holwerda on Tue 13th Oct 2009 18:24 UTC, submitted by Lazarus
Permalink for comment 389099
To read all comments associated with this story, please click here.
To read all comments associated with this story, please click here.
News
Linked by Thom Holwerda on 06/17/13 17:58 UTC
Linked by Thom Holwerda on 06/17/13 17:52 UTC
Linked by Thom Holwerda on 06/14/13 21:03 UTC
Linked by Thom Holwerda on 06/14/13 20:46 UTC
Linked by Thom Holwerda on 06/14/13 17:32 UTC
Linked by Thom Holwerda on 06/14/13 11:39 UTC
Linked by Thom Holwerda on 06/14/13 11:32 UTC
Linked by Thom Holwerda on 06/13/13 19:39 UTC
Linked by Thom Holwerda on 06/13/13 14:45 UTC
Linked by Thom Holwerda on 06/13/13 11:43 UTC
More News »
Sponsored Links



Member since:
2005-07-06
AFAIK, "blocks" is a bit of syntactic sugar that makes it much easier to write:
...
I thought that - and that seemed like an extension I'd be happy to have. But then I read something about the closure structure getting automatically copied to the heap if necessary, in certain circumstances. You can see you'd need to do this if you wanted to pass someone a closure to be called on completion, then return from the function you're currently running in.
The question is whether the C runtime is doing this or whether it's some kind of magic in GCD. If it's magic in GCD then I'm happy. If it's magic that's added to the C runtime then I'm not - C does not do heap memory allocations behind your back in basically any other context. so the addition of such would be highly disruptive. I'd really like clarification on how this blocks feature works!
Assuming it *is* just syntactic sugar then I would be all for it, I think that would be a fantastic feature for cutting down on code verbosity whilst still remaining close to the hardware.