Is public by default an unsafe default?

Dmitry Olshansky dmitry.olsh at gmail.com
Wed May 1 15:31:02 UTC 2024


On Wednesday, 1 May 2024 at 14:33:42 UTC, Steven Schveighoffer 
wrote:
> On Wednesday, 1 May 2024 at 11:52:30 UTC, NotYouAgain wrote:
>
>> Question 1 - is 'public by default' a sensible default for a 
>> language that is aiming to be safe by default?
>
> Yes, it's sensible.
>
> People most of the time want to use the things they write by 
> default, and so having members be public by default is what 
> people would expect.
>
> It becomes an annoyance for the developer in languages when you 
> forget the "public" equivalent, and have to go back and add it. 
> I've experienced this a lot with Angular/Typescript.

Kotlin is public by default and I enjoy it thoroughly.

Plus in D we can just slap private: at the top of the 
module/class.

—
Dmitry Olshansky
CEO @ [Glow labs](https://glow-labs.pro)
https://olshansky.me/about/



More information about the Digitalmars-d mailing list