Maybe D is right about GC after all !
John Gabriele
jgabriele at fastmail.fm
Fri Dec 22 18:59:34 UTC 2017
On Friday, 22 December 2017 at 16:17:33 UTC, Dan Partelly wrote:
> On Friday, 22 December 2017 at 15:23:51 UTC, Russel Winder
> wrote:
>> I think we are now in a world where Rust is the zero cost
>> abstraction language to replace C and C++, except for those
>> who are determined to stay with C++ and evolve it.
>
> Why should we settle for this ? D code (efortless) is easier to
> read then Rust. I assume this to be true for a lot of
> programmers who know C/C++. It also introperates very well with
> C, which is great boon, since at low level we live on the
> shoulder of a titan written in C. It has tremnedous features,
> and ironically the best of them could have been designed to not
> relay on GC. As most , if not all, of the features offered by
> its library could have been done with no GC.
>
>>
>> D, like Go, should glory in having a GC and just go with it.
>>
>> Of course this does not mean the GC as is is good enough. Go
>> is on its
>> third I believe, and Java on it's fifth.
>
> A good implementation at library level of GC would mean that I
> can use one single language
> in all areas of system programming. Or at least, a
> implementation where std:: and core features of language should
> not relay on GC. This, IMO is an advantage not to be neglected.
> A better C mode with a very powerfull high level standard
> library (like std:: ), exceptions, RAII, classes (yes, why not
> ) typeid would be a very big step ahead. All those could be
> done without having to worry about existence of GC. C++ has all
> those.
>
> IMO the key here is the standard libray of the language.
> Nothing in it should relay on the existence of GC. Why, why,
> does it have to depend on GC and hence automatically disqualify
> itself from a better C world ? The C runtime ezposed by core is
> powerfull, but imagine having std:: power in better C as well.
> I really lament this.
>
> You could have the best of the two worlds.
Regarding GC being built into the core language, from [the D
faq](https://dlang.org/faq.html):
"**Can't garbage collection be done in C++ with an add-on
library?**
Yes, I use one myself. It isn't part of the language, though, and
requires some subverting of the language to make it work. Using
gc with C++ isn't for the standard or casual C++ programmer.
Building it into the language, like in D, makes it practical for
everyday programming chores."
I'm new to D. Coming primarily from Python these days, I'm
looking at D not as a better C++ (haven't used that in many
years), but as a better Python.
More information about the Digitalmars-d
mailing list