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

Alfred Lopez

12/16/2020, 7:43 PM
So....is there a Kotlin equivalent to System?
b

Benjamin Charais

12/16/2020, 7:44 PM
In Multiplatform if you want access to system, you would need to use expect/actual and then for each target make a specific implementation of the functionality for that individual System.
a

Alfred Lopez

12/16/2020, 7:44 PM
k. Thanks!
b

Benjamin Charais

12/16/2020, 7:45 PM
Feel free to reach out for more info 🙂
a

Alfred Lopez

12/16/2020, 7:45 PM
[waving hand] This is not the answer I was looking for.....
🙂
Well, not what I was expecting
b

Benjamin Charais

12/16/2020, 7:46 PM
Sadly… I feel the same, a few months ago I had to create “File” representations for 3 targets
a

Alfred Lopez

12/16/2020, 7:46 PM
I'm in the same boat, but I'm using Korlabs korIO package
i

ian.shaun.thomas

12/16/2020, 7:46 PM
still early days, quite a few things are missing that are kind of critical near term like Date, Locale, File and general IO, knowing details about the host such as some of what System provides.
a

Alfred Lopez

12/16/2020, 7:46 PM
I don't know if it actually works. I'm still coding against it
b

Benjamin Charais

12/16/2020, 7:46 PM
I looked at theirs, I cant recall what about it that didn’t fit our usecase.
a

Alfred Lopez

12/16/2020, 7:47 PM
Lack of docs
😂 1
I have to read the test apps to figure out how to use it
Much less, understand what they do
But, I'm desparate
b

Benjamin Charais

12/16/2020, 7:48 PM
What functionality do you need?
a

Alfred Lopez

12/16/2020, 7:48 PM
I need to read properties files
for starters
I've completed the implementation with that lib, but now I'm facing the System issue
since I need to read the environment vars
But, perhaps I'll forego that aspect
b

Benjamin Charais

12/16/2020, 7:49 PM
If you need env… would it be better to handle that through gradle at compile time?
a

Alfred Lopez

12/16/2020, 7:50 PM
I need it at runtime, unfortunately
We have Java, Node and mobile platforms and I need to create a lib that works on all of them
I chose Kotlin because of "the promise", but I didn't realize that it can with "baggage"
But all's good
i

ian.shaun.thomas

12/16/2020, 8:09 PM
what I've done for those situations is use registration systems where the runtime can provide implementations that provide that information since System reading env variables breaks down in certain runtimes like JS web. In that kind of case, it doesn't necessarily make sense to use expect/actual if it likely can't have a reasonable actual on every target.
interfaces rather than expect/actual
a

Alfred Lopez

12/16/2020, 8:10 PM
Yeah, I just thought about that, but since I know this will only run in NodeJS (as well as JVM), I can use Node's process.env object
👍 1
2 Views