https://kotlinlang.org logo
Title
b

Bacho Kurtanidze

10/12/2019, 5:49 PM
wouldnt it be better if defult access-modifier was internal rather than public? I think it would make our code more encapsulated
🇳🇴 3
n

nfrankel

10/12/2019, 5:57 PM
whatever the relevance of your comment it’s not going to change as it would be a huge breaking change
b

Big Chungus

10/12/2019, 6:04 PM
I'm still not sure (as most of us I think) what internal even does.
s

serebit

10/12/2019, 6:05 PM
Internal prevents other modules or projects that consume your module from seeing those functions/properties/classes/etc
b

Big Chungus

10/12/2019, 6:07 PM
Does it, tho? Some of the stdlib for kotlin wasm is marked as internal, but i can still construct those objects.
s

serebit

10/12/2019, 6:10 PM
It should, and if it doesn't, that's a bug
b

Big Chungus

10/12/2019, 6:16 PM
I haven't tried compiling it though, so it might be an IDE bug for not showing any errors
m

Mike

10/12/2019, 10:27 PM
For a library writer, internal is very powerful. Can have something used in a lot of places in your library that a consumer can never touch. Java didn't have this feature. Default (Package- private) was the closest thing BUT we all know how to get around that and complain to the library dev when they break our code that uses something we weren't intended to use 😄
☝️ 3
s

Steve Young

10/14/2019, 8:08 PM
Accessing a library method that has modifier as “internal” will give an error “Cannot access ‘method_name’: it is internal in ‘package of the library method’