https://kotlinlang.org logo
d

Deactivated User

10/05/2017, 5:40 PM
I'd suggest adding the possibility of creating pure common libraries. Without having to manually implement them. Example: https://github.com/korlibs/korge/tree/ad5089fcf6fbc3849c8c8592752ba98ac735b804 Here I have a lot of sublibraries/extensions that I have to implement per target. Which is a bit crazy. Because all of them uses other common libraries and no platform-specific code. I think that you can just upload common versions and "instantiate" platform specific-artifacts locally. Either at build/ or in an external cache folder. Or even allowing to create a single jar with JVM code + other code embedded. Since the initial implementation should be simple I understand that it is not a priority right now, but I'd vote for it for a later release 🙂
2
e

elizarov

10/05/2017, 5:45 PM
We can think about allowing to add direct dependencies from an end-user platform-specific library to a “pure” common library. However, it means that “pure” library is going to be distributed in its source code and then compile and each use-site. It might be Ok and there are already examples in industry with a similar process (like in Go). This will require some extra work, though. For starters, those “pure Kotlin” common libraries have to marked as such and the compiler shall verify that they have not “expect” declarations.
👍 2
d

Deactivated User

10/05/2017, 5:49 PM
I see. Not sure about the whole implications. I thought that you could include just the UAST in a binary form. Eliminating the parse phase completely and making generating platform-specific code much faster. I understand the call-site places. Though I think it could be cached. Still it is just an idea, and of course it is just an optimization since I can still provide one version for each platform right now. But thanks for considering it 🙂
r

Ruckus

10/05/2017, 6:04 PM
@elizarov Would it be entirely out of the question to allow
expect
declarations in a "pure" common library, and let the user implement them as they see fit for whatever platform they are targeting?
e

elizarov

10/05/2017, 6:49 PM
For now we've decided that a library author provides impls for all the platforms. May relax that in the future.
👍 1
5 Views