Algorithms should be free from rich types

Steven Schveighoffer schveiguy at gmail.com
Fri Jun 30 02:09:42 UTC 2023


On 6/29/23 10:44 AM, Atila Neves wrote:
> On Tuesday, 27 June 2023 at 21:53:59 UTC, Ali Çehreli wrote:
>> My mind is not fully clear on this topic yet but some related things 
>> have been brewing in me for years.
>>
>> [...]
> 
> I have lost count of how many times my life has been made difficult by 
> the lack of `private`.
> 
> I have also lost count of how many times my life has been made easier by 
> the fact that I ruthlessly declare everything `private` unless it has 
> good reason not to be.
> 
> Ease of refactoring = good, ergo `private` = good and should be the 
> default.

private is good for the library writer.

arbitrary access to private is good for the user/hacker.

Honestly though, since private data is accessible through an escape 
hatch hack (i.e. `__traits(getMember)`), and the library writer can just 
say "whatevs, you broke it, you bought it", I think we are in a 
reasonable space.

-Steve


More information about the Digitalmars-d mailing list