Why not "private" as default visibility modifier?


#1

For both functions and properties. Effective java tells us "make all private as possible", and kotlin design is about glance. Closest example where its done: default final classes.

I found myself distracted by this in my classes:

 
private val 
private val 
private var
private var 
private var 
private var 
private val 

It seems natural to private "all the things", and then open only necessary ones.

I believe you discussed this before(didn’t found anything in this forums tho), and i just need to calm myself with reasons why it is done this way.


#2

+1 That would be really nice.


#3

It seems natural, but turns out to be very inconvenient (especially when it comes to busieness login with lots of data classes).


#4

Is the data classes are only serious problem?

Interfaces for example adds “magic” public in java
why not “magic” Internal- for data classes, they are already full of magic(i mean code generation)

in sacrifice for naturality!


#5

It's not only about classes marked with the "data" annotation, it's about all model classes that store a lot of data.


#6

Well, they made classes final by default and have forgot to make fields private. May be it’s a design decision which fits well with Kotlin. Don’t ask me how …