If you could make any changes to D, what would they look like?

Dennis dkorpel at gmail.com
Mon Oct 25 17:23:01 UTC 2021


On Monday, 25 October 2021 at 15:59:35 UTC, Adam D Ruppe wrote:
> On Monday, 25 October 2021 at 14:52:55 UTC, Dennis wrote:
>> Apart from `pure`, I agree with everything on that list, and 
>> would even add a bunch of things:
>
> Damn, like do you actually use *any* D features?

I know right? I'm starting to think maybe I should switch to Zig 
:p

I have used some of these features, but then they ended up being 
annoying or unnecessary anyway:

- Module constructors make it hard to see what's happening when 
the program starts. I once submitted a D program for an 
assignment and it failed because it loaded local files for 
unittests in a module constructor, which I forgot to remove 
because I only looked at main.
- opDispatch: suddenly member introspection 
(`__traits(hasMember)`) succeeds when you don't expect it, so now 
it's accepted as a broken InputRange/OutputRange/whatever in 
generic functions.
- alias this: I use it, I encounter 
[bugs](https://issues.dlang.org/show_bug.cgi?id=19477) and weird 
consequences like unexpected endless recursion, I remove it.

It's kind of like your quote from Discord:

> so many times a questions comes up in learn like "how would i 
> do this with metaprogramming" and im like "bro just use a 
> standard function like you would in javascript"

Nowadays whenever I can express something with plain old 
structs/functions/arrays/enums, I do that instead of anything 
fancy, and I'm liking the result.


More information about the Digitalmars-d mailing list