r/d_language • u/theofficialdeavmi • Sep 26 '17
I absolutely love programming in D
I cannot express how much I love programming in D. I have found it a good way to learn a lot of aspects of computer science (I am doing that course next year) but also as a good way to almost get your head into the world of programming in C (which I mess around with here and there).
I cannot express how well of a language D has been designed. Both its syntax (the design of the language's textual representation) as well as the semantics which make for such a great programming system.
There is just so much to love about this language.
UPDATE: And don't forget the amazing developers and community of D; they're spectacular.
5
u/netbioserror Sep 29 '17
Next to Clojure, I feel like D is a glimpse of what languages could be, and we're just weighed down by so much inertia from established languages that we may not see a world of great languages in production for some time.
That reminds me, a Clojure spinoff implemented in D with the D runtime might be great, if the GC were tidied up into a generational model...
2
u/theofficialdeavmi Sep 29 '17
But yes. D really does aim at being prettu much brilliant in my eyes. I recall watching a video where Andrei made a remark about Walter - saying that he had an eye for language design and hell yes was he right.
2
u/theofficialdeavmi Sep 29 '17
I agree that we are being wayed down by inertia of the current languages that follow the standard formula. D is beautiful.
1
u/theofficialdeavmi Sep 29 '17
Clojure is somethint I want to try out. As a Java user I really like that it uses Java bytecode as the compilation target as know the Clojure generated Java bytecode means the existing Java libraries and/or Kotlin can interoperate.
I'm putring Clojure back onto my todo list.
2
u/netbioserror Sep 29 '17
Clojure is like the perfect counter-point to D: Bytecode-compiled, a Lisp descendant, dynamically typed, runtime metaprogramming (as opposed to D doing it at compile time), code as data, data as code, and my favorite feature which I miss in D due to static typing: Arbitrarily nested heterogeneous data structures.
It turns out, representing the world - project configs, server configs, user files, save games, program states, calculation results, test data - as arbitrary nestings of lists and hash-maps and sets of all kinds of mixed data types is so natural that you long for that ability when you move back to static typing.
I'm sure that there's research to be done in this area: Using D's metaprogramming and templating, I'm sure somebody can implement very natural and simple-to-use arbitrary data structures. But that would take a lot of runtime type checking, as std.json already has to do.
3
u/jbb67 Oct 11 '17
Loving DLANG to the point where I have to write in C++ for work and find it frustrating now.
GC is great, it makes the code smaller, safer, sometimes faster and much easier to read and reason about. It's not always suitable though, and D does need a better story as a system programming language for when you need consistent latency and custom allocations. (But you don't need any of that most of the time).
I like having the syntax for slices and the way string works, and being able to iterator over a tuple. And if I ever have to write a compile time expression in C++ I think constexpr.. ugh.. and give up but in D it mostly just happens automatically.
And templates for anything but the simplest case in C++ are like writing in some alien language but in D it looks much more like regular code.
And modules just work. And thread_local stuff has advantages and disadvantages but you can choose not to use it and probably it's the best default.
I hated the distinction between class and struct at first as a C++ programmer but now I really appreciate the difference between value and reference classes. I like the copy and postblit thing too.
And being able to assume variables are initialized to zero (or whatever) means that I can write code that doesn't need a constructor because I can design it so that zero values work for that.
And writeln that can write anything out, and has a sane syntax unlike std::cout, oh and in fact being able to NOT prefix everything with the namespace to write safe code but being able to when you need it.
unittests, static initialization blocks. Small things but they make things so nice.
So many small things. It's like C++ done right.
1
u/theofficialdeavmi Oct 11 '17
It is like C++ done right. It is like the next C (in someway) (what C++ was meant to be).
2
0
14
u/FeepingCreature Sep 26 '17
It is pretty nice. GC could be better.
One "issue" with D is that it kind of ruins you for bad languages, and it itself isn't perfect so I feel like long-time D users have a more skeptical view of it and programming in general because it makes you aware how much nicer programming could be, then doesn't quite 100% deliver.
Still the nicest language I've ever used (that wasn't a language I made myself).