Is public by default an unsafe default?

Dukc ajieskola at gmail.com
Thu May 2 11:01:54 UTC 2024


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?

It's sensible - that's how C works after all. But it probably 
isn't optimal. Ideally `private` would be the default in my view.

> Question 2 - if public is not a sensible default for a language 
> that is aiming to be safe by default, is it too late to change 
> it?

Well, since we're going to have editions it could be changed 
easier than otherwise. But still, it's probably not worth it. 
It's still a good deal of migration work for those with lots of 
old code, over what's more a matter of taste than an universally 
agreed pain point.

> Question 3 - if a change was made, what would become the new 
> default?

The (present module-level) `private` visibility attribute I guess.




More information about the Digitalmars-d mailing list