Maybe D is right about GC after all !

Guillaume Piolat first.last at gmail.com
Thu Dec 21 13:27:55 UTC 2017


On Tuesday, 19 December 2017 at 13:14:50 UTC, Mark wrote:
> On Tuesday, 19 December 2017 at 09:54:05 UTC, Walter Bright 
> wrote:
>> "C, Python, Go, and the Generalized Greenspun Law"
>>
>> http://esr.ibiblio.org/?p=7804
>
> What do you think of the following comment to that article?
>
> "In well-written modern C++, memory management errors are a 
> solved problem. You can just write code, and know that the 
> compiler and library will take care of cleaning up for you, 
> just like with a GC-based system, but with the added benefit 
> that it’s deterministic, and can handle non-memory resources 
> such as file handles and sockets too."

As a former C++ programmer, the comment is exactly right, in C++ 
resource management is a solved problem (or at least feels like 
it which doesn't say much), and in D it's way more _complex_ 
(many cases, many workarounds, and _you have to understand it_, 
for example you need a mental model of how the GC works).

There is also a downside to the C++ scoped owership wa: you have 
to find an owner for everything even if they are just memory. So 
small scripts in D will be written almost 2x faster because of 
that and rich stdlib.



THe other


More information about the Digitalmars-d mailing list