no package protected makes me so frustrated... no ...
# announcements
a
no package protected makes me so frustrated... no real purpose of having unit tests in same package as what I am testing... to do unit tests practically would need each thing I am testing to be in a seperate module
💯 4
1
☝️ 4
m
Does visibility of classes impacts functionality of your code or tests?
d
Is there any real need to have package private access? If you someone has access to the source code they can always change a modifier anyway whenever they need to. If you are writing a library, it doesn't matter, because you have module level protection
j
It's useful in mixed codebases
a
@Marko Mitic it is nice for autocompletion and making sure I am referencing the right things I want to test
I am unit testing LeetCode-style code so I want each problem "modularized"
but at the same time making each problem a separate module is WAY too heavy weight
this is why package protected is very nice
j
Even as far as encapsulation goes, module to class is a big jump to make
4
a
@jw so what do you mean by it being "a big jump"? are you recommending me to use modules?
j
No. I'm advocating for package visibility
👍 2
m
Let's implement it guys, how hard can it be?
j
It's not omitted because it's hard. We need to provide a compelling reason for it to exist.
👍 2
a
to do this the "right" way with modules will take me about an hour to convert lol https://github.com/andrewgazelka/ProjectEuler/tree/style-modularize
g
give it some love: https://youtrack.jetbrains.com/issue/KT-29227 I was a bit emotional by that time, should have provide a less wordy description. My wild guess is they didn't think it through, the simplification went too far, also swift influence. Iirc, Dart has an interesting approach on this matter.
👍 1
a
@ghedeon link to Dart's approach? I don't know what to search for
g
It's not exactly the state of the art but
part/part of
in conjunction with underscore in Dart helps to group tightly coupled files. That being said, they plan to deprecate it in favor of a similar
friend
semantics. At least they got library visibility right: you expose explicitly your files and everything under
lib/src
is private to the library so you don't have to write tons of
internal
boilerplate. https://www.dartlang.org/guides/libraries/create-library-packages