Why is D unpopular?

Paul Backus snarwin at gmail.com
Sat Jun 11 04:00:32 UTC 2022


On Saturday, 11 June 2022 at 02:01:19 UTC, forkit wrote:
> Think of the module as a house.
>
[...]
>
> If you want even the most modest level of privacy, you need to 
> go build your own house.
>
> What I like to do, is put rooms in my house. Cause we're a 
> family, and we like living together - but some of us really do 
> want a reasonable, modest level of privacy - without having to 
> go build our own house.

I guess when you say "without having to go build your own house", 
you mean "without having to create a new file"? In other words, 
you would like encapsulation boundaries to be decoupled from file 
boundaries.

IMO the correct way to do this would be to simply allow multiple 
modules to be declared in the same file, rather than to couple 
encapsulation boundaries to class boundaries. This is a feature 
that has been requested many times for D, and one that several 
other languages have implemented successfully.

It is not entirely without downsides. Putting multiple modules in 
one file would complicate the build process somewhat--for 
example, `dmd -i` would no longer Just Work™ the way it currently 
does. But if someone could put together a convincing DIP, I think 
it's possible this feature could be added to D in the future.


More information about the Digitalmars-d mailing list