Why is D unpopular

bauss jj_1337 at live.dk
Mon Jun 13 07:59:24 UTC 2022


On Monday, 13 June 2022 at 04:39:23 UTC, Mike Parker wrote:
>
> Right now, you can split your module into two files and present 
> them to the world as a single module with package.d. What does 
> your suggestion buy us that this doesn't aside from a single 
> module name trait?

Let's see.

a.d
```
module a;

class Foo
{
	private:
	int _c;
}

import b;
void handle(Bar child)
{
   child._c += child.c;
}
```
b.d
```
module b;

import a;

class Bar : Foo
{
	public:
	int c;

	this(int c)
	{
		this.c = c;
	}
}
```

main.d
```
module main;

import a;
import b;

void main()
{
	auto bar = new Bar(30);
	handle(bar);
}
```

If D is truly "module private" then the above should be able to 
compile, if it's "class private" then it shouldn't be able to 
compile.

Since the above doesn't compile then D isn't really "module 
private" and thus the conclusion is that one of the most 
fundamental features of D is also an unfinished feature.

D states it is "module private" but really it is neither "module 
private" or "class private" it's a mix between the two... and I'm 
not sure whether that's good or not.


More information about the Digitalmars-d mailing list