I love D

harakim harakim at gmail.com
Thu Oct 5 21:46:05 UTC 2023


On Tuesday, 26 September 2023 at 15:55:36 UTC, bachmeier wrote:
> I doubt that there's any realistic scenario where D will ever 
> be a big player in web development.

I also doubt it because C# is practically perfect for web 
development. I think D would be good at web development, but not 
something to drop dotnet over.

I feel like D is really good at writing solid business logic that 
is predictable about how it will behave and perform. I don't need 
500 frameworks to write usable code in D and I can use language 
features to tighten it up and reduce chances for mistakes. And 
the performance is good and you can reason about it. Also, I can 
do pretty much anything I want in it.

I think the typical way the people find new languages is #1 
school or job and that's not going to favor D any time soon. 
However, basically everyone goes and explores other languages. 
Think about when you explored a language. Why did you do it?

In my experience, it usually boils down to having a specific 
project, finding a language that has that niche and doing the 
project. Once you do that, if the experience was decent, you give 
it another chance. Maybe you keep working on that original 
program. If it goes well, you naturally reach out for that 
language again for a future project. (I understand people try new 
languages, but unless they get a job, I rarely see them stick 
with it.)

For example, I set out to write a game (niche). I looked at game 
engines and languages. No engines really supported the game I was 
making. I really liked C and Java but I had problems with both. 
So I stumbled on D. I had a good experience and I have come back 
ever since. I wrote the game again in D2. It was a great choice. 
I bought Andrei Alexandrescu's book and it was like a revelation. 
C-syntax with garbage collection and classes is good enough. The 
threading model, the direct memory access through pointers, 
bindings to C libraries and good performance really made me feel 
proud of what I had created. So since then, I've been committed.

When I was running, my running partner collected data on his 
watch. He would dump the times, locations and elevations to me 
and I used excel to process it. I would calculate our best mile, 
our best 200m, how much hills affected our run and everything. It 
was slow, but it didn't need to be fast. The first version 
probably took me an hour and had most of what we wanted. As a 
result of the success, I always turn to excel or google sheets 
first for stuff like that now.

I think D is barely lacking, but is lacking in every part of this 
process. People have come to D over the years. I think a lot of 
that is because if there a problem is no other language has 
focused on, D is by default a good choice because it is at least 
*good* at everything. In that sense, D has had good niches. In 
fact, D is one of the most common uncommon languages among older 
programmers. I was talking to someone at my work about the future 
of programming and mentioned D and I was right, he had used it 
before. So why is there a problem with niches? Because other 
languages and libraries for those languages have come a long way. 
And D hasn't kept up.

There is no start to finish niche (for me) that D is good at. If 
I want to crunch numbers, I turn to excel. If I want to make a 
UI, I necessarily turn to Javascript/html and a self-loathing or 
else .NET and XAML. If I want to make a web backend, I can use 
dotnet or many people would use Java Spring or node.js. I mean, I 
can write a webserver in express.js in 20 minutes. As far as I 
can tell, there isn't a real good game engine solution in D yet 
(I haven't checked in a few years.) Now, if I just need a command 
line program, you better believe I'm writing it in D. Mostly the 
same for a TCP server. So, in my estimation, D doesn't have that 
start to finish experience that makes it strong in some niche.

I want to emphasize that D is great for writing from scratch, so 
in my opinion for any new niche that emerges it's automatically a 
top player and that is a huge strength that keeps bringing people 
in.

Once they get here, they might not have that smooth, successful 
experience. T

They might be scared off by the lack of tooling. Most newer 
developers are used to tik tok, youtube and sub-20 minute 
tutorials. They are not used to learning a command line and 
having to actually learn language syntax from the get-go without 
IDE help. They are not used to having to look up documentation on 
libraries. The IDE just tells them with intellisense or module 
suggestion. Older developers are probably more open to lesser 
tooling in exchange for a better language.


The library situation might leave a bad taste in their mouth. The 
standard library surprises me often with the functions it does 
have. However, it can be a bit hard to find them. If I were new, 
I would never think to look for string functions in 
std.algorithm. Also, some functions exist but are named 
differently than in every other language. I feel like that's 
fine, but it makes them hard to find.  The documentation for the 
standard library has gotten much better since years ago, but it 
sometimes misses an essential example. Now that I understand the 
method signatures, this is not an issue, but it has been a big 
one in the past. When you don't understand the standard types or 
temples, the syntax of a simple function in the standard library 
can be difficult. I have thought about writing a book giving a 
tour of the standard library but my personal life does not allow 
for the time commitment I would need.

Then there is the lack of third party libraries. Even if you find 
one, it might not compile anymore or the tutorial you are using 
might be so out of date it doesn't work anymore. That even goes 
for libraries that are just bindings.

Andrei's book was essential for me to be successful with my D2 
game. It did a good job making sense of the language features. 
Until I had that, I didn't even know why I wasn't allowed to cast 
an immutable to not immutable and vice versa. I understand in 
theory why it could be bad and appreciate it, but I didn't 
understand D was enforcing that. There were probably 10 or 20 of 
these gotchas that all piled onto each other and made reasoning 
difficult. The compiler errors are often no help. If it weren't 
for the book, I would have been lost.

Then there are things that need to be cleaned up and that is 
vying with not breaking existing code. I think that balance, or 
strategy rather, will be the key for D's success in the years 
ahead.

I think D is in a unique place being good at everything and not 
having a lot of dependencies. I think the industry is reaching a 
turning point where people will say enough is enough with all the 
frameworks. Then there are the tools that hang while they index 
or do intellisense. And, frankly, Java, Javascript and even 
Python are using so many third party libraries and frameworks 
these days that when something goes wrong, it is often the case 
that no one at a smaller company will be able to figure it out. 
Performance issues are taking up more time and money. And then 
there are the litany of security issues that arise from the 
interactions of hundreds of libraries. I don't think it's a 
sustainable path and a few co-workers have mentioned this to me 
as well.

Just as kind of an aside, but you can already see bugs affecting 
a lot of life. There were some examples in the 2019 Dconf 
presentation "All Spreadsheets Must Die". I was talking with one 
of the people at my new job and they complained about the state 
of software. I told them I knew all about that. They said I had 
normalized it and I didn't realize. So I wrote them all down. I 
wrote dozens of things that week with at least one major issue a 
day from a XSS vulnerability at my credit card website and a 
financial website being unavailable to my plane decompressing! 
(To be sure, that might have been hardware.)

I do web development for a living, but I still cringe every time 
I have to do front end work. Right now, I'm off and on trying to 
make D work as a front end language. Failing that, whatever 
language ends up being good for desktop UI development is going 
to draw me in with that niche. I'll still use D, but that 
language is going to earn a place at my table even if it's 
horrible at most everything else.

I love D. I love the built in threads and messaging. I love the 
succinctness of associative arrays and lists. I sometimes love 
immutability. I like templates. I love that there is a GC option. 
There is so much more that I like and more that I just take for 
granted.

I think a lot of other people would if they gave it a chance and 
I think I outlined the reasons. Like I said, D is at least good 
in basically every way. The issues I mentioned are not difficult, 
they just take work. I don't think any of these issues are as 
large as those facing other languages like C++ and Java. As for 
me, I hope I get time to contribute more to the D community and 
I'm happy with the direction it's going.


More information about the Digitalmars-d mailing list