Hey, I'm relatively new to kotlin, for now its ver...
# getting-started
b
Hey, I'm relatively new to kotlin, for now its very smooth experience for me, but one thing that bothers me is that there is no package-private modifier, so does it mean that kotlin doesn't need it or its one of the downsides that should be fixed?
l
What about
internal
?
k
Opinions differ, I think it's a missing feature but the Kotlin designers don't think it is.
There's a lot of discussion on the forums about this.
m
It all comes down to how you organize your code, and how you want to control usage of things, and how much help you require from the compiler to control visibility. Package- private has always been a bit 'odd' because you can create that package in your project if you want to modify something in a library. Internal is stricter in that regard. If you organize by feature rather than function, package private doesn't help. If you truly want to hide something, then ideally those things would be in their own module, and internal would suffice. But having a bunch of modules creates it's own overhead. Personally, I rely on common sense and code review for appropriate usage, especially since I've started organizing by feature rather than function. So as Karel said, some will say it's a missing feature, and others don't miss it. If not obvious, I fall in the latter group.
👆 1