What are the prominent downsides of the D programming language?

Arafel er.krali at gmail.com
Tue Sep 29 17:54:41 UTC 2020


On 29/9/20 19:20, H. S. Teoh wrote:
> On Tue, Sep 29, 2020 at 12:52:30PM -0400, James Blachly via Digitalmars-d wrote:
> [...]
>> This [`auto` being used to simplify complex return types; and the
>> notion of potentially very complex template-generated return types in
>> general, especially as a componetn of the stdlib] is something that I
>> think would improve visibility and adoption if it were explicitly
>> addressed in tutorials, documentation, books, etc.
> 
> Yeah, this needs to be addressed head-on, rather than skirted around or
> deferred to the reference docs.  I think a lot of newcomers to D
> wouldn't have the concept of opaque types that they don't need to know
> explicitly yet can use effectively.  That's a pretty advanced concept
> rarely found in other languages; it would do a lot of good to explain
> this concept right from the get-go.
> 
> 
> T
> 

I think this is an area were "concepts" [1] would shine. It would be 
cool if there were some kind of "statically typed interface" that you 
would declare as a type, exposing the needed functionality, and that 
would hide the implementation details. Something like this (AIUI the UDA 
makes possible even to leave out `auto`):

```
@models!(isInputRange) foo = ....; // Very long UCFS chain.
```

This would tell you all that you should reasonably need to know about 
the type, while still allowing lower level access if needed, because the 
actual type would remain unchanged. Also, it would statically check that 
the guarantees are kept, i.e. that if a template is supposed to return 
an input range, it actually does without some corner case silently 
breaking `empty`, for instance.

It would be great then if the IDE tools could make use of this, and even 
more to have a more compact syntax built-in into the language.

A.

[1]: https://code.dlang.org/packages/concepts


More information about the Digitalmars-d mailing list