https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
p

pajatopmr

12/01/2018, 7:42 AM
I have pushed the initial code for the KFile project, my attempt to provide a library that provides a canonical Kotlin file class for JVM and Native platforms. https://github.com/pajato/KFile
👍 4
m

msink

12/01/2018, 10:31 AM
I think Native implementation can be adapted from scala-native: https://github.com/scala-native/scala-native/tree/master/javalib/src/main/scala/java/io
p

pajatopmr

12/01/2018, 1:27 PM
I will check it out. Thanks.
t

thevery

12/01/2018, 3:03 PM
GPL :(
m

msink

12/01/2018, 3:52 PM
j

juancho

12/01/2018, 4:49 PM
Why did you choose to make KFile an interface and not an “expected” class?
p

pajatopmr

12/01/2018, 4:54 PM
Mostly historic. I started off just to build a TextFile interface and that morphed into a KFile interface. Why do you ask? If I am missing something, and I easily could be, it would be good to know.
Actually a better answer is that I am partial to: a) interfaces and abstract classes over concrete classes, and b) factory methods over constructors.
r

russhwolf

12/01/2018, 11:12 PM
Using interfaces in a library makes it easier for clients to mock the library out when they want to test their own logic in isolation.
d

Dico

12/02/2018, 2:09 AM
Does kotlinx-io library not have a multiplatform file manipulation api?
I guess not
j

juancho

12/02/2018, 4:20 AM
Thanks @pajatopmr! I just asked for curiosity, I’m still learning about Kotlin multiplatform and I feel a little lost in these cases to define something as “expect class” or interface. Thanks!
p

pajatopmr

12/10/2018, 12:20 PM
@thevery GPL was a mistake. I meant to use LGPL in case it matters. I will fix this on 0.0.2.
t

thevery

12/10/2018, 1:16 PM
Of course it is your choice, but lgpl limits usage, too. Why not APL as most other libs and kotlin itself?
5 Views