DIP69 - Implement scope for escape proof references
via Digitalmars-d
digitalmars-d at puremagic.com
Wed Dec 17 06:57:23 PST 2014
On Wednesday, 17 December 2014 at 13:48:24 UTC, deadalnix wrote:
> If you have owner ship, you have free. If you have a pair
> alloc/free then you can promote on stack.
>
> This is a much more powerful way to handle things, as this take
> advantage of inlining.
More powerful than what?
Rather than thinking in terms of alloc/free it might be helpful
to think about it more generally as resources, use, reuse and
side-effects. On the stack you get to reuse memory when the
variable is not longer live, meaning you junk writes if the
results cannot be read and reuse the memory "prematurely".
http://en.wikipedia.org/wiki/Live_variable_analysis
If you are saying that turning GC allocations automatically into
stack allocations is a good direction for D2, then I agree.
More information about the Digitalmars-d
mailing list