On Friday, 12 September 2025 at 18:19:46 UTC, Brother Bill wrote:
Is there a 'style' guide for D, such as: Do this, Don't do
that, avoid this, etc.?
Someone will link the "offical" style guide, but thats nothing id
follow
"There are these features in the language, but you should avoid
them, unless absolutely necessary", and then saying how many
developers use language features when unnecessary?
Id avoid, annotations (all of them), delegates, classes, manual
allocating extremists of all 3 flavors, multithreading (if you
must, keep it functional and hope std.parrell works)
Solve your control flow in ranges, and if its a nightmare of a
problem unit test them with plain old data types like ints.
I am trying to understand the clean way of using D.
I suggest chasing "Expressive" not clean
Most computer languages, such as Eiffel, don't even consider
adding this feature of preventing construction.
Clearly, D has them for 'good' reasons.
Im pretty sure your just factually wrong in this case, I think
disable this is well known accidental feature, and it caused
allot of problems in the std trying to work around it. And
well... thats not how you should relate with how the compiler is
made in general; to this day walter doesnt do template
metaprogramming and they were added halfway into the compilers
life span(d was a c with classes compiler for 10 years before
walter got annoyed with the c spec committy); and its still a new
frontier in general.
The compiler isnt a clean well made work of art; its 30 years of
hacks and experiments with several features being complete
accidents; with 50/50 odds on being formalized. Templates *in
general* are not understood, their turing completeness was an
accident in c++.