On Tuesday, 11 April 2017 at 00:11:01 UTC, Adam D. Ruppe wrote:
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.

I don't agree as you have to add `scope` for the class to be allocated on the stack.

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:

Yes, but it must be done in such a way that a user never knows the difference. I have my doubts about whether replacing all heap allocations in `throw new` expressions will be as transparent. Actually it's already not as there are restrictions on catch blocks that catch refcounted Exceptions.

Reply via email to