Real D

Martyn martyn.developer at googlemail.com
Mon Apr 15 16:40:20 UTC 2024


On Saturday, 13 April 2024 at 13:55:50 UTC, Marconi wrote:
> .. snip
> What D should be?
> C with fat pointers, no header files and a big OO standard 
> library.
> That's it. A better C. A new C. 90% C + 5% Cpp + 5% Java.
> .. snip


D is a swiss army knife of programming languages. It supports 
many ways to get a problem done.

However... D can also be open to disagreements because... it is a 
swiss army knife!

What I mean is D is trying to please everyone. It can be very 
difficult to get right when you have programmers from different 
career backgrounds throwing in their views of what D should (and 
shouldn't) be.

In part we have a confusion of what D is trying to be. Some see 
it as a C or C++ replacement. Others see it as a Java or C# one 
(and others). The rest see it as a replacement of all the above.

I can be guilty of this as well. I have my **preferences** of 
where I would like D to go. We all do. Regardless, D is here adnd 
its current position stays. I dont think anyone at this point for 
*force out* features just because. Reality is while some want to 
ditch the GC, there are others on here that would want to force 
it on you.

I think we should be targeting the C\C++ guys but competition is 
growing. We not only have Rust, but others like Zig and Odin. 
Trying to win over a Java or C# dev is going to be tough 
especially when developer has gained experience and familiarity 
of the language. Also factor in job security. Mid-to-Large 
companies likely favour Microsoft tools so C#, along with Azure, 
SQL Server, etc, is not going anywhere. It is not about 
individual devs, but companies themselves enforcing what you will 
be using. It is a hard battle to win in my opinion.

The more I have used D, the more I have been using BetterC. I 
have become familiar with what I can and cannot do with BetterC. 
It really is experience. However, I don't think it is easy when 
you are new to D, and browsing around the website for the first 
time.

For new devs coming from a Java or C# background, the Dlang Tour 
and Guide is good. Sadly, those that come from a C or C++ 
background are likely put off pretty quickly. The landing page, 
to me, makes D come across as a garbage collected language 
**only**.

*Maybe this is the intention by the core team as this will lose 
interest for certain newcommers and focus on their main audience. 
It is possible.*

Continuing, I come across pages like so:-
- https://dlang.org/
- https://dlang.org/overview.html

Eventually I see some code like filter! or Ranges, etc. I would 
be very impressed with the compiler likely telling me to "perhaps 
import std.stdio;"  -- so far, so good.

Once I understood some basic D features, I would then be looking 
at the Garbage Collector. Can I turn it off?

I couldn't find the answers I wanted on the website. The overview 
had a sentence for "Explicit Memory Management" with **no links**.
"Automatic Memory Management" on the other hand  had more text 
and **a link!**

Even the Garbage Collector page did not redirect me to how to 
disable it. At least, I could not see it. I tried searching on 
the page but unsuccessful.

- https://dlang.org/spec/garbage.html

I am sure, at this point, I would be googling around, or using 
Stack overflow or reddit, etc. Now  I would be trying to find 
answers outside of the D website.

Once I discovered -betterC I would struggle to understand why it 
is called "Better C". I am trying to learn D afterall. After 
adding the flag and running the compiler, I now receive the 
following sample errors:-

- cannot use try-catch..
- template instance std.stdio.File.write!..
- TypeInfo_Class..

What? I did not use try-catch! Oh, so I cannot use Ranges.
What? std.stdio.File.write causes an error? This worked before i 
added -betterC. Oh.. stdio, or parts of it, must be using the GC.
What? BetterC is just better C. Guess I cannot improve my C++ 
that has classes?

The learning would continue but there is a chance, if the site 
did not lose my interest earlier... you have now.


Maybe the DLang Tour needs a little more TLC. Start off with 
their purpose of using D. Maybe BetterC should be there from the 
get go! branch off in 2 directions. You want to try do in all its 
glory.. go here. Want to turn off the Garbage Collector.. go 
betterC! etetera!!


More information about the Digitalmars-d mailing list