November 05, 2022
On 03.11.22 05:54, Max Samukha wrote:
> 
> The millions of lemmings might be right in this case. There seems to be no good reason to think module-level is superior to class-level. It is definitely surprising and annoying to a lot of programmers coming from class-based OOP languages.

FWIW Delphi added "strict private" and "strict protected".
November 06, 2022
On 06/11/2022 5:23 AM, 12345swordy wrote:
> Which honestly, that should be even more of an indicator that D should drop the one module per file restriction, and allow multiple modules in a single file.

Not at all.

Its an entirely different concept and has to do with distribution rather than the programming language itself.

November 05, 2022

On Saturday, 5 November 2022 at 16:23:34 UTC, 12345swordy wrote:

> >

Java has modules. They are not mapped to a file. The above is regarding files not (Java) modules.

https://en.wikipedia.org/wiki/Java_Platform_Module_System

Which honestly, that should be even more of an indicator that D should drop the one module per file restriction, and allow multiple modules in a single file.

I like the D system. We sort the code to files with similar logic way we sort it to namespaces anyway. Having to add a namespace block that encompasses the whole file to every single of them is just annoying for no good reason.

Now I wouldn't mind if there was a way to have in-file modules in addition to a file being a module (though I'd question if the additional complexity is justified), but if I have to pick one or the other I prefer the D system hands down.

November 05, 2022
On 11/1/2022 3:22 AM, zjh wrote:
> 还是定位的问题,`D`定位在哪?要`聚焦`!这才是根本问题.

We prefer English be used on the forums.
November 05, 2022
On 11/5/2022 2:26 PM, Dukc wrote:
> I like the D system. We sort the code to files with similar logic way we sort it to namespaces anyway. Having to add a namespace block that encompasses the whole file to every single of them is just annoying for no good reason.
> 
> Now I wouldn't mind if there was a way to have in-file modules in addition to a file being a module (though I'd question if the additional complexity is justified), but if I have to pick one or the other I prefer the D system hands down.

Using the module as the fundamental unit of encapsulation and making it a 1:1 correspondence with files is a good fit for modern filesystems. (Old filesystems were so slow most people would try to cram a program into a small number of files.)

Divorcing modules from file names makes for clumsy, hackish attempts solutions to figuring out which file a particular module resides in.
November 06, 2022
On 06/11/2022 2:56 PM, Walter Bright wrote:
> Using the module as the fundamental unit of encapsulation and making it a 1:1 correspondence with files is a good fit for modern filesystems. (Old filesystems were so slow most people would try to cram a program into a small number of files.)

We do have this handy dandy little assumption in our design however:

``foo\bar.d(1): Error: package name 'foo' conflicts with usage as a module name in file foo.d``

```
.
├── entry.d
├── foo
│   └── bar.d
└── foo.d
```

It does mean we can place multiple modules in a file as long as only one of them is the root.

```d
module root;

module root.foo {

}
```

November 06, 2022

On Saturday, 5 November 2022 at 21:26:16 UTC, Dukc wrote:

>

[...]

Yeah, one of my favorite features of D is its module system, especially coming from C. Now if only we could have module templates to further my ML-D fantasy.

November 06, 2022

On Sunday, 6 November 2022 at 03:37:13 UTC, CM wrote:

>

On Saturday, 5 November 2022 at 21:26:16 UTC, Dukc wrote:

>

[...]

Yeah, one of my favorite features of D is its module system, especially coming from C. Now if only we could have module templates to further my ML-D fantasy.

mixin template doesn't scratch that itch?

November 05, 2022
On 11/5/2022 9:52 AM, razyk wrote:
> FWIW Delphi added "strict private" and "strict protected".

D will go one better:

  "private IReallyMeanItThisTime"
November 06, 2022

On Sunday, 6 November 2022 at 04:50:18 UTC, Tejas wrote:

>

On Sunday, 6 November 2022 at 03:37:13 UTC, CM wrote:

>

On Saturday, 5 November 2022 at 21:26:16 UTC, Dukc wrote:

>

[...]

Yeah, one of my favorite features of D is its module system, especially coming from C. Now if only we could have module templates to further my ML-D fantasy.

mixin template doesn't scratch that itch?

I do indeed use other kinds of aggregate templates, and they're a fine workaround; Nonetheless, module templates would be nicer, though hardly important given other matters. Because—y'know—I could just use an ML.