digitalmars.D - About removing the new keyword
- Craig Black (7/7) Aug 29 2010 It seems that much of the community is for removing the new keyword, but...
- Daniel Gibson (5/6) Aug 29 2010 Really? This is the first time I've heard about this.
- bearophile (9/11) Aug 29 2010 It was discussed a lot, and some people were about OK with the idea. The...
- Andrej Mitrovic (11/22) Aug 29 2010 I think it's nice when you want to differentiate between making a
- Andrei Alexandrescu (5/11) Aug 29 2010 The definite decision is delete will be deprecated following a staggered...
- Daniel Gibson (5/19) Aug 29 2010 Ok.
- Andrej Mitrovic (2/25) Aug 29 2010
- Era Scarecrow (22/47) Aug 29 2010 In my opinion and thoughts (although they may be wrong or misguided), ...
- Paulo Pinto (5/8) Sep 01 2010 Why not?
It seems that much of the community is for removing the new keyword, but Walter is not. I've thought up a compromise that Walter may agree to and that would not require any syntax changes. It's a very simple idea: What if new could be defined as a template, but called without the ! so that the syntax for calling new would not change. Just an thought. May or may not be a good one. -Craig
Aug 29 2010
Craig Black schrieb:It seems that much of the community is for removing the new keyword,Really? This is the first time I've heard about this. Why should it be removed anyway? There has been some discussion about removing "delete" (is there any definite decision on that yet?) though.
Aug 29 2010
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
Aug 29 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 lycos.com> wrot= e:Daniel Gibson:current new syntax is not nice looking, and maybe not necessary. The idea i= s to remove all not necessary things from D2 (if their absence doesn't ugli= fy the code too much and doesn't reduce flexibility significantly).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 =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 b=est chance to introduce this.Bye, bearophile
Aug 29 2010
On 08/29/2010 11:28 AM, Daniel Gibson wrote:Craig Black schrieb:The definite decision is delete will be deprecated following a staggered schedule (deprecated for six months, removed thereafter). Walter didn't have the time to get to that. AndreiIt seems that much of the community is for removing the new keyword,Really? This is the first time I've heard about this. Why should it be removed anyway? There has been some discussion about removing "delete" (is there any definite decision on that yet?) though.
Aug 29 2010
Andrei Alexandrescu schrieb:On 08/29/2010 11:28 AM, Daniel Gibson wrote:Ok. If delete is removed, how will Explicit Class Instance Allocation ( http://www.digitalmars.com/d/2.0/memory.html#newdelete ) work? Isn't delete needed for that?Craig Black schrieb:The definite decision is delete will be deprecated following a staggered schedule (deprecated for six months, removed thereafter). Walter didn't have the time to get to that. AndreiIt seems that much of the community is for removing the new keyword,Really? This is the first time I've heard about this. Why should it be removed anyway? There has been some discussion about removing "delete" (is there any definite decision on that yet?) though.
Aug 29 2010
I think that one is going as well (IIRC). On Sun, Aug 29, 2010 at 8:49 PM, Daniel Gibson <metalcaedes gmail.com> wrote:Andrei Alexandrescu schrieb:On 08/29/2010 11:28 AM, Daniel Gibson wrote:Ok. If delete is removed, how will Explicit Class Instance Allocation ( http://www.digitalmars.com/d/2.0/memory.html#newdelete ) work? Isn't delete needed for that?Craig Black schrieb:The definite decision is delete will be deprecated following a staggered schedule (deprecated for six months, removed thereafter). Walter didn't have the time to get to that. AndreiIt seems that much of the community is for removing the new keyword,Really? This is the first time I've heard about this. Why should it be removed anyway? There has been some discussion about removing "delete" (is there any definite decision on that yet?) though.
Aug 29 2010
== Quote from Andrej Mitrovic (andrej.mitrovich gmail.com)'s articleI think that one is going as well (IIRC). On Sun, Aug 29, 2010 at 8:49 PM, Daniel Gibson <metalcaedes gmail.com> wrote:In my opinion and thoughts (although they may be wrong or misguided), wouldn't removing 'new' be a bad thing? I suppose you could live without it; however the syntax may get larger and maybe more unsightly (or more complex rules) to compensate for it which is counter productive. Also 'new' is a declaration and a reminder of intent; you know your creating an object and the compiler wouldn't have to do anything extra. Besides, keeping it a simple and better structured language (code and compiler wise) is what i think makes D such a wonderful language. As for delete, 95%+ of the time with a garbage collector you don't need it. However you can still turn off the garbage collector. Since you can (and if you do) and there's no way to manually free the resources, If your program is memory hungry it would be eventual your program finishes properly or crashes from no memory left. In instances of manual control (Say a private inner class) where reference can't go outside of the class, and can guarantee no other references to the object may want to use delete. Also since this is a OS building language, i wouldn't expect a garbage collector in that instance at all. So, Delete should just be discouraged, not removed. EraAndrei Alexandrescu schrieb:On 08/29/2010 11:28 AM, Daniel Gibson wrote:Ok. If delete is removed, how will Explicit Class Instance Allocation ( http://www.digitalmars.com/d/2.0/memory.html#newdelete ) work? Isn't delete needed for that?Craig Black schrieb:The definite decision is delete will be deprecated following a staggered schedule (deprecated for six months, removed thereafter). Walter didn't have the time to get to that.It seems that much of the community is for removing the new keyword,Really? This is the first time I've heard about this. Why should it be removed anyway? There has been some discussion about removing "delete" (is there any definite decision on that yet?) though.
Aug 29 2010
Why not? There are many examples of operating systems with garbage collector built-in. "Era Scarecrow" <rtcvb32 yahoo.com> wrote in > to use delete. Also since this is a OS building language, i wouldn't expect a garbagecollector in that instance at all.So, Delete should just be discouraged, not removed. Era
Sep 01 2010