Maybe D is right about GC after all !
Dylan Graham
dylan.graham2000 at gmail.com
Sun Dec 24 15:00:09 UTC 2017
On Saturday, 23 December 2017 at 08:15:04 UTC, Dan Partelly wrote:
> On Saturday, 23 December 2017 at 01:12:53 UTC, Dylan Graham
> wrote:
>> language it should be, not the language some C++ programmer
>> wants but is never going to use anyway.
>
> Ironically, D is so close to beeing the language a C++
> programmer would really use that you can smell it. It doesnt
> have to bend, since it got so close with a lot of good
> decisions. D is the first language Im aware of which has the
> potential to satisfy the needs of a very large portion of the
> market,
How much further does D have to go to start snatching C++'s
userbase?
In my honest opinion, D doesn't offer as much of an advantage
over C++ as it does C# and Java. Currently D has much better
template syntax, modules (although that idea is being floated in
the C++ community), but what else? The C++ juggernaut keeps
piling on new features every 3 years. It's hard for D to stay in
the lead (that is if it is).
I've been writing a voxel engine in C#. Writing anything high
performance in C# becomes non-idiomatic, you're locked into OOP
and performance sucks.
D offers far more features C# and Java. As a result, I think D
would have a greater appeal on those audiences.
For example, writing vector structs in C# requires you to
duplicate the code for each size of the vector and then again for
each type. You can cut down on the type duplications by using the
dynamic keyword but that infers a performance hit. On the flip
side, D's metaprogramming reduces the complexity of writing such
utilities.
Furthermore, C# and Java deeply emphasise the OOP paradigm.
They're not very expressive languages. D can do everything C#'s
OOP can do and offers many other paradigms. D is more a toolbox
to let you program the way you want. C++ is much the same, just
uglier. Thus, there's going to be less draw to D from C++.
I also recall someone saying that C++'s memory problem is fixed.
D's MMM seems infantile in comparison.
Also, there is not much in the way of getting around C#'s GC.
Well, you can. But it gets ugly and unidiomatic. You also have to
consult the documentation frequently to know what certain
allocates. In D you can receive warnings about what allocates GC
memory (compiler flag -- can't remember which one (-vgc on DMD?))
and also enforce non-gc allocations. It also lets me use other
memory management techniques if need be.
I think D should try to advertise to more restrictive languages
such as C# and Java and present itself as a general purpose
language. I think it will draw more people from the C#/Java crowd
than it will from the C++ crowd.
More information about the Digitalmars-d
mailing list