Why I Like D
Araq
rumpf_a at web.de
Fri Jan 14 06:20:58 UTC 2022
On Friday, 14 January 2022 at 02:13:48 UTC, H. S. Teoh wrote:
> It takes 10x the effort to write a shell-script substitute in
> C++ because at every turn the language works against me -- I
> can't avoid dealing with memory management issues at every turn
> -- should I use malloc/free and fix leaks / dangling pointers
> myself? Should I use std::autoptr? Should I use
> std::shared_ptr? Write my own refcounted pointer for the 15th
> time? Half my APIs would be cluttered with memory management
> paraphrenalia, and half my mental energy would be spent
> fiddling with pointers instead of MAKING PROGRESS IN MY PROBLEM
> DOMAIN.
>
> With D, I can work at the high level and solve my problem long
> before I even finish writing the same code in C++.
Well C++ ships with unique_ptr and shared_ptr, you don't have to
roll your own. And you can use them and be assured that the
performance profile of your program doesn't suddenly collapse
when the data/heap grows too big as these tools assure
independence of the heap size. (What does D's GC assure you? That
it won't run if you don't use it? That's such a low bar...)
Plus with D you cannot really work at the "high level" at all, it
is full of friction. Is this data const? Or immutable? Is this
@safe? @system? Should I use @nogc? Are exceptions still a good
idea? Should I use interfaces or inheritance? Should I use class
or struct? Pointers or inout? There are many languages where it's
much easier to focus on the PROBLEM DOMAIN. Esp if the domain is
"shell-script substitute".
More information about the Digitalmars-d-announce
mailing list