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

Jonathan M Davis <issues.dl...@jmdavisprog.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dl...@jmdavisprog.co
                   |                            |m

--- Comment #4 from Jonathan M Davis <issues.dl...@jmdavisprog.com> ---
(In reply to Adam D. Ruppe from comment #3)
> I'd actually just like to redefine `new` to mean the compiler is free to
> stack allocate it when it can prove the lifetime does not exceed that of the
> function (and the scope annotations can hint/prove/override this, as it
> already does for classes[!])

Well, in principle, with DIP 1000, the case where scope on classes allocates
the class on the stack simply becomes a compiler optimization rather than the
specific purpose of scope (rather, the purpose of scope at that point is to
give the compiler the information it needs to guarantee that no pointers or
references or whatnot to the variable or object escape). As such, I don't see
any reason why that optimization couldn't be expanded to cover other types
allocated with new.

--

Reply via email to