Eliminate "new" for class object creation?

2009-10-19 Thread Andrei Alexandrescu
I'm having a hard time justifying that you use new X(args) to create a class object, and X(args) to create a struct object. I wrote this: The syntactic difference between the expression creating a @struct@ object---Test(@\meta{args}@)@---and the expression creating a @class@

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Adam D. Ruppe
On Mon, Oct 19, 2009 at 05:38:13PM -0500, Andrei Alexandrescu wrote: > I hereby suggest we get rid of new for class object creation. What do > you guys think? Didn't we go over this a few weeks ago? I think my preference would be a bunch of templates in phobos that take new's job, and can also do

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Denis Koroskin
On Tue, 20 Oct 2009 02:38:13 +0400, Andrei Alexandrescu wrote: I'm having a hard time justifying that you use new X(args) to create a class object, and X(args) to create a struct object. I wrote this: The syntactic difference between the expression creating a @struct@ obj

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Andrei Alexandrescu
Denis Koroskin wrote: On Tue, 20 Oct 2009 02:38:13 +0400, Andrei Alexandrescu wrote: I'm having a hard time justifying that you use new X(args) to create a class object, and X(args) to create a struct object. I wrote this: The syntactic difference between the expression cr

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Yigal Chripun
On 20/10/2009 00:38, Andrei Alexandrescu wrote: I'm having a hard time justifying that you use new X(args) to create a class object, and X(args) to create a struct object. I wrote this: The syntactic difference between the expression creating a @struct@ object---Test(@\meta{args

Re: Eliminate "new" for class object creation?

2009-10-19 Thread dsimcha
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article > I'm having a hard time justifying that you use > new X(args) > to create a class object, and > X(args) > to create a struct object. I wrote this: > > The syntactic difference between the expression creating

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Rainer Deyke
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. -- Rainer Deyke - rain...@eldwood.com

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Bill Baxter
On Mon, Oct 19, 2009 at 4:00 PM, Rainer Deyke 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

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Rainer Deyke
Bill Baxter wrote: > On Mon, Oct 19, 2009 at 4:00 PM, Rainer Deyke wrote: >> '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 should ha

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Jason House
Bill Baxter Wrote: > On Mon, Oct 19, 2009 at 4:00 PM, Rainer Deyke 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, t

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Leandro Lucarella
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 wrote: > > > Andrei Alexandrescu wrote: > > >> I hereby suggest we get rid of new for class object creation. What do > > >> you guys think? > > > > > > *applause* > >

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Robert Jacques
On Mon, 19 Oct 2009 18:45:01 -0400, dsimcha wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article I'm having a hard time justifying that you use new X(args) to create a class object, and X(args) to create a struct object. I wrote this: The syntactic

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Brad Roberts
Robert Jacques wrote: > On Mon, 19 Oct 2009 18:45:01 -0400, dsimcha wrote: > >> == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s >> article >>> I'm having a hard time justifying that you use >>> new X(args) >>> to create a class object, and >>> X(args) >>> to create a struct ob

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Andrei Alexandrescu
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 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

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Andrei Alexandrescu
Brad Roberts wrote: Why do we still have static opcall? What role does it play that ctors don't? Return "new C" for classes for consistency with structs :o). class C { static opCall(T...)(T args) { return new C(args); } ... } Andrei

Re: Eliminate "new" for class object creation?

2009-10-19 Thread dsimcha
== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'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 wrote: > Andrei Alexandrescu wrote: > > I he

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Robert Jacques
On Mon, 19 Oct 2009 22:53:23 -0400, Brad Roberts wrote: Robert Jacques wrote: On Mon, 19 Oct 2009 18:45:01 -0400, dsimcha wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article I'm having a hard time justifying that you use new X(args) to create a class object

Re: Eliminate "new" for class object creation?

2009-10-19 Thread Andrei Alexandrescu
dsimcha wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'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 wrote: Andrei Alexandrescu wrote: I hereby suggest

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Chris Nicholson-Sauls
Andrei Alexandrescu wrote: I'm having a hard time justifying that you use new X(args) to create a class object, and X(args) to create a struct object. I wrote this: The syntactic difference between the expression creating a @struct@ object---Test(@\meta{args}@)@---and the ex

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Kagamin
Andrei Alexandrescu Wrote: > I'm having a hard time justifying that you use > > new X(args) > > to create a class object, and > > X(args) > > to create a struct object. I wrote this: > > > The syntactic difference between the expression creating a @struct@ > object---Test(@\me

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Lionello Lunesu
On 20-10-2009 6:38, Andrei Alexandrescu wrote: I hereby suggest we get rid of new for class object creation. What do you guys think? I don't agree with this one. There's extra cost involved, and the added keyword makes that clear. Also, somebody mentioned using 'new' to allocate structs on th

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Max Samukha
On Tue, 20 Oct 2009 18:12:39 +0800, Lionello Lunesu wrote: >On 20-10-2009 6:38, Andrei Alexandrescu wrote: >> I hereby suggest we get rid of new for class object creation. What do >> you guys think? > >I don't agree with this one. > >There's extra cost involved, and the added keyword makes that c

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Yigal Chripun
Chris Nicholson-Sauls Wrote: > Andrei Alexandrescu wrote: > > I'm having a hard time justifying that you use > > > > new X(args) > > > > to create a class object, and > > > > X(args) > > > > to create a struct object. I wrote this: > > > > > > The syntactic difference between t

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Andrei Alexandrescu
Lionello Lunesu wrote: On 20-10-2009 6:38, Andrei Alexandrescu wrote: I hereby suggest we get rid of new for class object creation. What do you guys think? I don't agree with this one. There's extra cost involved, and the added keyword makes that clear. That's actually one problem: a struc

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Andrei Alexandrescu
Max Samukha wrote: On Tue, 20 Oct 2009 18:12:39 +0800, Lionello Lunesu wrote: On 20-10-2009 6:38, Andrei Alexandrescu wrote: I hereby suggest we get rid of new for class object creation. What do you guys think? I don't agree with this one. There's extra cost involved, and the added keyword

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Leandro Lucarella
Andrei Alexandrescu, el 19 de octubre a las 22:16 me escribiste: > dsimcha wrote: > >== Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article > >>Leandro Lucarella wrote: > >>>Jason House, el 19 de octubre a las 22:20 me escribiste: > Bill Baxter Wrote: > > >On Mon,

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Andrei Alexandrescu
Leandro Lucarella wrote: Andrei Alexandrescu, el 19 de octubre a las 22:16 me escribiste: dsimcha wrote: == Quote from Andrei Alexandrescu (seewebsiteforem...@erdani.org)'s article Leandro Lucarella wrote: Jason House, el 19 de octubre a las 22:20 me escribiste: Bill Baxter Wrote: On Mon,

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Leandro Lucarella
Andrei Alexandrescu, el 20 de octubre a las 08:42 me escribiste: > >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. > > > > > > It's not a useless discussions, name

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Rainer Deyke
Andrei Alexandrescu wrote: > Lionello Lunesu wrote: >> Also, somebody mentioned using 'new' to allocate structs on the heap; >> I've never actually done that, but it sounds like using 'new' would be >> the perfect way to do just that. > > Yah, I guess I'll drop it. Consistency with structs demand

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Chad J
Andrei Alexandrescu wrote: > Leandro Lucarella wrote: >> Andrei Alexandrescu, el 19 de octubre a las 22:16 me escribiste: >>> 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. >>> >>> { >>> au

Re: Eliminate "new" for class object creation?

2009-10-20 Thread Pelle Månsson
Andrei Alexandrescu wrote: Max Samukha wrote: On Tue, 20 Oct 2009 18:12:39 +0800, Lionello Lunesu wrote: On 20-10-2009 6:38, Andrei Alexandrescu wrote: I hereby suggest we get rid of new for class object creation. What do you guys think? I don't agree with this one. There's extra cost invo