Andrei Alexandrescu, el 19 de octubre a las 22:16 me escribiste: > dsimcha wrote: > >== Quote from Andrei Alexandrescu ([email protected])'s article > >>Leandro Lucarella wrote: > >>>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 <[email protected]> > >>>>>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 :) > >>Scope will go (and this time I'm not kidding). It's very unsafe. > >>Andrei > > > >But we need a reasonable way of allocating class instances on the stack as an > >optimization. Scope provides a nice way to do that. In general, I'm sick of > >hearing about safety. D is a close-to-the-metal systems language. The > >programmer > >has to be given control. In general I think we're going waaaay off the deep > >edge > >trying to make D too safe lately at the expense of convenience and > >performance. > > No problem. You will be able to use InSitu!T. It is much better to > confine unsafe features to libraries instead of putting them in the > language. > > { > auto foo = InSitu!(Foo)(args); > // use foo > ... > // foo goes away > }
<useless discussion> Why not Scoped!T ? I think the purpose for this that the lifetime of the object is bounded to the scope, right? I think is hard to figure that out from InSitu!T than Scoped!T. </useless discussion> -- Leandro Lucarella (AKA luca) http://llucax.com.ar/ ---------------------------------------------------------------------- GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145 104C 949E BFB6 5F5A 8D05) ---------------------------------------------------------------------- - Mire, don Inodoro! Una paloma con un anillo en la pata! Debe ser mensajera y cayó aquí! - Y... si no es mensajera es coqueta... o casada. -- Mendieta e Inodoro Pereyra
