On Monday, 10 April 2017 at 23:16:48 UTC, Meta wrote:
My knee jerk reaction is that it's a very bad thing that "new" means the same thing everywhere in the language (allocate and initialize some GC-managed memory), except for this one case.

Actually, in addition to user defined overloads (which are deprecated, granted), `new` also can mean stack allocation already! See the `scope` storage class and scope classes.

The language is free to optimize `new` as it sees fit. (IMO, that's the only real justification for it even being a built in language feature instead of an ordinary library function.) The real changes in this proposal are:

1) if the compiler is aware that new will be implemented in such a manner as to not use the gc, it will pass the static @nogc fit.

2) the catch block is restricted a bit in order to enable this optimization.

`new` itself isn't really changing since it was already allowed to do this in cases the compiler can prove its lifetime.

Reply via email to