Re: eliminate new operator paraphernalia

2010-02-15 Thread Simen kjaeraas
grauzone n...@example.net wrote: what does paraphernalia mean? http://dictionary.reference.com/browse/paraphernalia : 1. (sometimes used with a singular verb) equipment, apparatus, or furnishing used in or necessary for a particular activity: a skier's paraphernalia. 2.

Re: eliminate new operator paraphernalia

2010-02-15 Thread Jacob Carlborg
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

Re: eliminate new operator paraphernalia

2010-02-15 Thread dsimcha
== Quote from Jacob Carlborg (d...@me.com)'s article 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

Re: eliminate new operator paraphernalia

2010-02-15 Thread grauzone
dsimcha wrote: 2. Pointer offset information for each type is determined at compile time using template metaprogramming. Why don't you just ask Walter to make dmd generate the necessary information?

Re: eliminate new operator paraphernalia

2010-02-15 Thread dsimcha
== Quote from grauzone (n...@example.net)'s article dsimcha wrote: 2. Pointer offset information for each type is determined at compile time using template metaprogramming. Why don't you just ask Walter to make dmd generate the necessary information? Three reasons: 1. Walter has

Re: eliminate new operator paraphernalia

2010-02-15 Thread Andrei Alexandrescu
Sean Kelly wrote: 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

Re: eliminate new operator paraphernalia

2010-02-15 Thread Steven Schveighoffer
On Sun, 14 Feb 2010 13:17:44 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org 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

Re: eliminate new operator paraphernalia

2010-02-15 Thread Pelle MÃ¥nsson
On 02/15/2010 01:27 PM, grauzone wrote: How is filling with .init not a waste of time? It needs to fill with .init and run the default constructor (if any). Contracts, and all that.

Re: eliminate new operator paraphernalia

2010-02-15 Thread Lars T. Kyllingstad
Steven Schveighoffer wrote: On Sun, 14 Feb 2010 13:17:44 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org 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

eliminate new operator paraphernalia

2010-02-14 Thread Andrei Alexandrescu
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. I think

Re: eliminate new operator paraphernalia

2010-02-14 Thread bearophile
Andrei Alexandrescu: What do you think? Can the new keyword be removed from D2 and replaced by some class method new? :-) Bye, bearophile

Re: eliminate new operator paraphernalia

2010-02-14 Thread Michel Fortin
On 2010-02-14 13:17:44 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org said: 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

Re: eliminate new operator paraphernalia

2010-02-14 Thread Andrei Alexandrescu
Michel Fortin wrote: On 2010-02-14 13:17:44 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org said: 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

Re: eliminate new operator paraphernalia

2010-02-14 Thread Justin Johansson
Michel Fortin wrote: Also, why remove anonymous classes? Me thinks that whoever suggested that anonymous classes be removed is best to remain anonymous. :-) Justin Johansson

Re: eliminate new operator paraphernalia

2010-02-14 Thread Nick Sabalausky
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message news:hl9n50$2f9...@digitalmars.com... There are many problems with custom allocators. They hook the syntax and do something that's unbecoming. new T must place T on the garbage-collected heap, period. That gives the

Re: eliminate new operator paraphernalia

2010-02-14 Thread Nick Sabalausky
Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message news:hl9end$1u8...@digitalmars.com... Second, the whole new anonymous class thing is for Java's sake. Do you think we need to keep all that? It doesn't bother me having it, but I can't say I can imagine ever having a use

Re: eliminate new operator paraphernalia

2010-02-14 Thread Andrei Alexandrescu
Nick Sabalausky wrote: Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message news:hl9n50$2f9...@digitalmars.com... There are many problems with custom allocators. They hook the syntax and do something that's unbecoming. new T must place T on the garbage-collected heap, period.

Re: eliminate new operator paraphernalia

2010-02-14 Thread Andrei Alexandrescu
Nick Sabalausky wrote: Andrei Alexandrescu seewebsiteforem...@erdani.org wrote in message news:hl9end$1u8...@digitalmars.com... Second, the whole new anonymous class thing is for Java's sake. Do you think we need to keep all that? It doesn't bother me having it, but I can't say I can

Re: eliminate new operator paraphernalia

2010-02-14 Thread dsimcha
== Quote from Nick Sabalausky (a...@a.a)'s article And as for the infinite lifetime guarantee: I don't think I see any risk of a custom-allocated object getting yanked out from under generic code unless you did something *really* bizarre and obviouly pointless like lauch a thread that

Re: eliminate new operator paraphernalia

2010-02-14 Thread Michel Fortin
On 2010-02-14 15:41:30 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org said: Michel Fortin wrote: Hum, what's the syntax for placement delete? There is no need for placement delete. There will be a function clear() in object.d that only calls the destructor. (That is needed

Re: eliminate new operator paraphernalia

2010-02-14 Thread Andrei Alexandrescu
Michel Fortin wrote: On 2010-02-14 15:41:30 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org said: Michel Fortin wrote: Hum, what's the syntax for placement delete? There is no need for placement delete. There will be a function clear() in object.d that only calls the destructor.

Re: eliminate new operator paraphernalia

2010-02-14 Thread Kasumi Hanazuki
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) This may be a bit off-topic, but now is the chance to think about the array-new'ing syntax...

Re: eliminate new operator paraphernalia

2010-02-14 Thread Michel Fortin
On 2010-02-14 17:21:51 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org said: Michel Fortin wrote: On 2010-02-14 15:41:30 -0500, Andrei Alexandrescu seewebsiteforem...@erdani.org said: Michel Fortin wrote: Hum, what's the syntax for placement delete? There is no need for

Re: eliminate new operator paraphernalia

2010-02-14 Thread Andrei Alexandrescu
Kasumi Hanazuki wrote: 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) This may be a bit off-topic, but now is the chance to think about the

Re: eliminate new operator paraphernalia

2010-02-14 Thread Jonathan M Davis
Andrei Alexandrescu wrote: Also, if you really want to put an object back in it's initial state, you could call both the destructor and the constructor. Anything else is going to break the object's invariant. I think it's best to leave breaking the object's invariants to a special syntax,