ugly and/or useless features in the language.
H. S. Teoh
hsteoh at quickfur.ath.cx
Sun May 16 16:16:22 UTC 2021
On Sat, May 15, 2021 at 02:31:08PM +0000, Alain De Vos via Digitalmars-d-learn wrote:
> Which parts in dlang don't you use and why ?
>
> Personally i have no need for enum types, immutable is doing fine.
> Auto return types i find dangerous to use.
> Voldermont types.
> Named initialiser.
> Tuple features.
> Maybe some other ?
> Feature creep can make your own code unreadable.
>
> Offcourse taste can very from person to person.
I cannot live without auto return types and Voldemort types. They are my
bread and butter. Take them away, and I might as well go back to C/C++.
Also, unittests. The quality of my code has improved by leaps and bounds
ever since I started writing unittests, and their convenience (you can
write them literally next to the code they test) cannot be overstated.
What I find inconvenient:
- const-correctness, including immutable. It's all nice and everything
because of its strong guarantees, but that also greatly limits its
usefulness. In practice, I find that it's really only usable in
self-contained, low-level code / leaf node modules in the program's
dependency graph. For high-level code it quickly becomes a burden to
maintain const-correctness, and often the need for casts will arise
because there will always be *something* that wants logical const
rather than physical const / immutable, so APIs that try to be const
correct usually have bugs / missing cases where something should be
const but can't be, or something should accept mutable but can't
because of overzealous application of const.
- Don't get me started about inout, which is quirky, has ambiguous cases
as soon as delegates / function pointers are involved, and just
introduces weird corner cases into the type system. Terrible for
generic code because of the difficulty of dealing with cases involving
inout in a generic way.
What I find ugly:
- shared, and all of its quirks and incomplete implementation.
- The fact that byte + byte cannot be assigned back to a byte without a
cast. The fact that f(1) will choose the f(bool) overload instead of
the f(int) overload. The fact that Walter insists that bool is a
1-bit integral type instead of a true boolean type.
- Autodecoding in Phobos, the big wart that we still haven't rid
ourselves of after so many years.
- Attribute proliferation. We should have had type inference integrated
into the language from the beginning, but alas, that ship has already
long sailed and it's too late to change that now.
- Other incomplete / half-implemented stuff in D.
T
--
There are three kinds of people in the world: those who can count, and those who can't.
More information about the Digitalmars-d-learn
mailing list