What are (were) the most difficult parts of D?

templatedperson templated at person.com
Wed May 11 18:27:57 UTC 2022


On Wednesday, 11 May 2022 at 05:41:35 UTC, Ali Çehreli wrote:
> What are you stuck at? What was the most difficult features to 
> understand? etc.
>

I don't know if this counts as a feature, but reading the 
standard library documentation was especially difficult. There 
are a ton of `auto`s everywhere and function signatures are hard 
to read because of that. I got used to confusing function 
signatures in a week or two, but it made me consider not using D.

> To make it more meaningful, what is your experience with other 
> languages?
>

Rust does a better job at this. Generics are strongly-typed with 
`trait`s. In D, we have to type-check `struct`s ourselves by 
adding `if (is(T == SomeType))` etc. after the function 
declaration. In Rust, you can create a `trait` and use that as 
the parameter type in a function.

In D we can have this with `interface`s when we're using 
`class`es but we can't have this for `struct`s. Actually, I'd 
appreciate if we could get `static interface`s or something, so 
that people won't need to type-check manually.


More information about the Digitalmars-d-learn mailing list