About removing the new keyword
Andrej Mitrovic
andrej.mitrovich at gmail.com
Sun Aug 29 11:13:19 PDT 2010
I think it's nice when you want to differentiate between making a
struct/class object. Otherwise you'll end up doing:
C c; // This is a class object, not a struct!
Unless something else like templated constructors could help with
this, but I'm not sure what those are yet. :p
On Sun, Aug 29, 2010 at 7:43 PM, bearophile <bearophileHUGS at lycos.com> wrote:
> Daniel Gibson:
>> Really? This is the first time I've heard about this.
>> Why should it be removed anyway?
>
> It was discussed a lot, and some people were about OK with the idea. The current new syntax is not nice looking, and maybe not necessary. The idea is to remove all not necessary things from D2 (if their absence doesn't uglify the code too much and doesn't reduce flexibility significantly).
>
> A problem is that to new you need to give three things:
> - optional placement, where to put the data
> - what type to allocate
> - an optional list of arguments for the constructor
> - and some people have asked for templated constructors, so this is the best chance to introduce this.
>
> Bye,
> bearophile
>
More information about the Digitalmars-d
mailing list