Wed Oct 17 - Avoiding Code Smells by Walter Bright

Dennis dkorpel at gmail.com
Fri Nov 9 00:47:05 UTC 2018


On Thursday, 8 November 2018 at 23:50:18 UTC, TheFireFighter 
wrote:
> No it is not. You can keep saying there is, but it doesn't make 
> it so.
> ...
> We don't seem to be on the same page here...do you 
> misunderstand what I want?

Fair enough, the exact thing you want is not possible. I 
understand that. It's also a fact that you can't have a 
value-type class. But just because you can't have a value type 
*class* doesn't mean you can't have a value-type aggregate: there 
is struct. The higher goal of encapsulating classes is possible 
by writing one per module and using package.d, it's just not 
possible with the restriction that multiple classes must be in 
the same file.

> Regarding the 'burden' to the D langauge, by providing the 
> programmer with a tool to specify better encapsulation of code 
> *within* the module:
>
> [quote]
>
> i.e. better encapsulation really is a good thing (although for 
> many, it a lesson that needs to be learned).

Walter considers the module the lowest level of encapsulation, 
while you consider the class to be that. Neither is proven to be 
better so far. To change the D language in that regard, you have 
to convince people that class-private is superior/important 
enough to warrant the language change. Unfortunately, the 
arguments given so far have not done that yet, since they mostly 
appeal to feeling, fear and 'the obvious' as mentioned earlier.


More information about the Digitalmars-d-announce mailing list