Basically, would you rather want everything in a class/module/struct/whatever to be inaccessible by anything else unless you give a keyword saying it’s public (like Rust) or have everything accessible unless you make it private (like Ruby and Crystal)? Why?

Also, what do you think of languages that make you write public or private for every member, or ones that inherit the default state from whatever the parent member is?

  • DessalinesA
    link
    22 years ago

    For Object oriented / class-focused languages, I kinda like default public members like Ruby or typescript does. You’re making something where you’re going to use its functionality elsewhere, so it saves some characters to have default public.

    Both work tho, and rust isn’t too bothersome because the compiler will tell you when you’re missing the pub keyword.