digitalmars.D - Re: Opt-out closures
- bearophile <bearophileHUGS lycos.com> Jan 23 2011
Andrew Wiley:I don't like being too negative, but if we're removing "scope" as a storage class because it can leave unsafe dangling pointers, how likely is it that we'll get delegates that can have dangling pointers?
I have written that without too much thinking, so I'm sure that's not a perfect idea :-) Regarding "scope" for classes, it is deprecated, instead of improving it, but the currently alternative solution is _less_ safe than the scope, and it's more buggy: http://d.puremagic.com/issues/show_bug.cgi?id=5115 A Java VM like the Oracle one has the best GC, plus escape analysis that allows it to stack-allocate some class instances. Currently D compilers have a far worse GC and even LDC-LLVM escape analysis is weak and it doesn't do much for D class instances. In my opinion D and its compilers need to perform that stack optimization by themselves, or the programmer needs to be "empowered" with some good, efficient and as much safe as possible way to stack allocate a class instance. At the moment D has none of both. Good luck with a slow system language :-) Bye, bearophile
Jan 23 2011