Eliminate "new" for class object creation?

Leandro Lucarella llucax at gmail.com
Mon Oct 19 19:34:02 PDT 2009


Jason House, el 19 de octubre a las 22:20 me escribiste:
> Bill Baxter Wrote:
> 
> > On Mon, Oct 19, 2009 at 4:00 PM, Rainer Deyke <rainerd at eldwood.com> wrote:
> > > Andrei Alexandrescu wrote:
> > >> I hereby suggest we get rid of new for class object creation. What do
> > >> you guys think?
> > >
> > > *applause*
> > >
> > > 'X(x)' and 'new X(x)' have distinct meanings in C++. ?In Java/C#/D, the
> > > 'new' is just line noise.
> > 
> > Well, I think "new Foo" is how you create a struct on the heap in D.
> > So it's not exactly line noise.
> > I don't mind getting rid of new, but there better be a good way to
> > allocate structs on the heap.  And it better not require me to do an
> > import just to be able to call the allocation function.
> > 
> > I like the Foo.new syntax myself.
> > 
> > --bb
> 
> Actually, new can also be used for creating classes on the stack... 
> scope T t = new T();

Damn! This is getting confusing. It seems like allocation should be
revised altogether :)

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
Si el enemigo se siente abatido, recuérdele que su familia está lejos y
que mientras siga la pelea él se estará perdiendo el crecimiento de sus
hijos. Si está feliz, recuerdele de la existencia de su familia
política, en especial de los cuñados que tienen sexo con sus hermanas.
	-- Ricardo Vaporeso. De la desmoralización del enemigo.



More information about the Digitalmars-d mailing list