Adding a new design constraint to D

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Sat Jun 18 09:32:43 UTC 2022


On Saturday, 18 June 2022 at 08:04:55 UTC, FeepingCreature wrote:
> I mean, I think it's important in this case because aiui 
> `private` is ignored in modules because modules are the more 
> central unit of abstraction than classes; a function in a 
> module is "on the same level" as a method in the class. So in 
> that specific sense, it's more correct to call D a module-based 
> language than a class-based one.

I guess I understand what you mean, you can technically use a 
module as a singleton, but I would claim that modules primarily 
are namespaces.

But it is a fact that it is *very unusual* to provide many access 
control mechanisms, but not class-private. Even Python, that 
provides no access control, does at least do name mangling for 
class private fields. So being surprised about this is warranted.

(Not suggesting this is a pressing issue for D, as things like 
getting better memory management is much more important.)




More information about the Digitalmars-d mailing list