February 26, 2009 Re: Beginning with D | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Tim M | Tim M wrote:
> On Fri, 27 Feb 2009 01:42:17 +1300, bearophile <bearophileHUGS@lycos.com> wrote:
>
>> Rainer Deyke:
>>> My opinion: D 1.0 is, on the whole, worse than C++.
>>
>> There are many things in D1 better than C++, in particular you need less time learn the language and less time to write programs that work correctly.
>>
>> Bye,
>> bearophile
>
> I think the key here is "on the whole" and in opinion. I'm not really interested in D vs C++ one sided arguments but apart from the constness in D2 what other features does C++ have over D?
The most prominent feature is value semantics for classes and better support for RAII style resource management compared to D1. Furthermore C++ allows you much more flexibility when it comes to operator overloading, but if that is a good thing is up for debate. And finally in C++ we have the preprocessor of course...
Other than that, I can't think of anything in the language itself. If you could argue that STL is part of the C++ language, than that counts too.
I don't see MI as a feature of C++ above D1, because everything you can reasonably do with MI can be done in D1 with interfaces and mixins.
| |||
February 26, 2009 Re: Beginning with D | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Lutger | Lutger Wrote: > Tim M wrote: > > > On Fri, 27 Feb 2009 01:42:17 +1300, bearophile <bearophileHUGS@lycos.com> wrote: > > > >> Rainer Deyke: > >>> My opinion: D 1.0 is, on the whole, worse than C++. > >> > >> There are many things in D1 better than C++, in particular you need less time learn the language and less time to write programs that work correctly. > >> > >> Bye, > >> bearophile > > > > I think the key here is "on the whole" and in opinion. I'm not really interested in D vs C++ one sided arguments but apart from the constness in D2 what other features does C++ have over D? > > The most prominent feature is value semantics for classes I don't agree with this one. Classes and structs are identical in C++ (except for default protection). In D, they differ. For value semantics, use structs in D. > and better support for RAII style resource management compared to D1. Furthermore C++ allows you much more flexibility when it comes to operator overloading, but if that is a good thing is up for debate. And finally in C++ we have the preprocessor of course... > > Other than that, I can't think of anything in the language itself. If you could argue that STL is part of the C++ language, than that counts too. > > I don't see MI as a feature of C++ above D1, because everything you can reasonably do with MI can be done in D1 with interfaces and mixins. > > | |||
February 26, 2009 Re: Beginning with D | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jason House | Jason House wrote: > Lutger Wrote: > >> Tim M wrote: ... >> > D2 what other features does C++ have over D? >> >> The most prominent feature is value semantics for classes > > I don't agree with this one. Classes and structs are identical in C++ (except for default protection). In D, they differ. For value semantics, use structs in D. I didn't mean to say this is a better design in C++, just that it's different. I probably misunderstood the question, it wasn't meant as a value judgement at all. In fact all the features I mentioned I think are for the worse, not better. Except raii perhaps, although I don't think this is so important when you have GC and scope(). | |||
February 26, 2009 Re: Beginning with D | ||||
|---|---|---|---|---|
| ||||
Posted in reply to grauzone | grauzone wrote: > Going back from D to C++ also feels like stepping back, because C++ doesn't natively support garbage collection. While I admit that reference counting is better for "heavy" resources (like file handles), for small memory objects tracing garbage collection is actually more efficient and less problematic. For example, reference counting can't deal with cycles of garbage. Between cycle-breaking and support for "heavy" resources, I'd take the latter over the former any day. IME heavy resources are very common, and cycles are relatively rare. This is especially true for game programming. I have many options for handling cycles in C++. I have no reasonable options for handling heavy resource in D1. > And what's so great about wrapping every pointer into a smartpointer? Consistent syntax? Having a choice of smart pointers? Honestly, I can't see a way to avoid smart pointers even in D2. A language like Python may not need them, but then Python has reference counting and destructors that actually work in addition to garbage collection. And weak references. -- Rainer Deyke - rainerd@eldwood.com | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply