eliminate new operator paraphernalia

Jacob Carlborg doob at me.com
Mon Feb 15 05:05:49 PST 2010


On 2/14/10 19:17, Andrei Alexandrescu wrote:
> Currently new is baroque to the extreme. Should we eliminate the
> class-specific allocators in favor of a simple scheme for placement new?
> All that's really needed is to construct an object of a given type at a
> given address. All of the syntactic mess around it is unnecessary.

Didn't dsimcha or someone work on an implementation of a precise GC that 
needed changes to this sort of things. If so, make sure you take those 
changes into account.

> I think class-specific new and delete are not a useful feature.
>
> Second, the whole new anonymous class thing is for Java's sake. Do you
> think we need to keep all that?

Yes I think so. Removing that will break the whole DWT library.

> I suggest the following syntaxes for a type T, an integral length, an
> initializerlist a la "e1, e2, e3, ..." that could be empty, and an addr
> convertible to void*:
>
> new T[length]
> new T(initializerlist)
> new(addr) T[length]
> new(addr) T(initializerlist)
>
> and call it a day.
>
> What do you think?
>
>
> Andrei




More information about the Digitalmars-d mailing list