https://issues.dlang.org/show_bug.cgi?id=22331

--- Comment #2 from Steven Schveighoffer <[email protected]> ---
(In reply to anonymous4 from comment #1)
> Umm, the stack advice is solid, you just apparently conflate lifetime with
> lexical scope.

How would you leave a pointer on the stack?

This doesn't work:

------
void foo()
{
  auto c = new Class; // not on the stack
  c.method(); // c still not stored on the stack.
  GC.collect(); // possibly will collect c.
}
------

The recommendation in the spec is to use a "parameter or automatic variable".
This doesn't work. If the recommendation is to store on the stack is solid, it
should provide a solid mechanism to do so.

--

Reply via email to