LionWeb-io / lionweb-java

Apache License 2.0
3 stars 1 forks source link

Integrating repo client and kotlin lib #157

Closed ftomassetti closed 4 months ago

ftomassetti commented 4 months ago

With this PR I integrate in lionweb-java the repo client and a few facilities to use LionWeb Java from Kotlin. This is code I developed and used internally at Strumenta for a few months.

Note that both the new modules are written with Kotlin.

We could later do a significant refactoring.

I think that at this stage the most important module is the repo client. It includes functional tests that download the LW Repo and start it.

ftomassetti commented 4 months ago

Thank you for the review!

enikao commented 4 months ago

Do we really want to mix in Kotlin with LW-Java? Then people who want to use this need to be able to build Kotlin, and contributors need to at least read Kotlin.

ftomassetti commented 4 months ago

Do we really want to mix in Kotlin with LW-Java? Then people who want to use this need to be able to build Kotlin, and contributors need to at least read Kotlin.

The users would have the possibility to import the modules that use Kotlin (repo-client and kotlinlib). The latter module is intended for people using Kotlin: if someone does not use Kotlin than they can just not add the module to their dependencies and safely ignore it. People developing in Java may be instead interested in using repo-client. It can indeed be used from Java, and if the user writes java they would not need to compile any kotlin.

Contributors would need to compile Kotlin, but they would not need to install anything manually: running gradle tasks take care of downloading everything they need. They would need to understand Kotlin if the want to contribute to the repo-client and kotlinlib modules. For the latter this is unavoidable, for the former this could be avoided rewriting such module in Java. That would require some work and make development more difficult (as Java 8 is arguably less productive than Kotlin. Maybe Java 21 is comparable to Kotlin, but adopting it means making the module unaccessible to most Java developers). Given this is a matter affecting contributors and not users, I am not sure it would make sense to convert the module to Java.

The alternative is to move these two modules into a separate project. This is doable, but it would then means that we may sometimes need to do two releases (i.e., when changing LW Java we may want to release it, go to the other project consisting of repo-client and kotlinlib, update the LW Java dependency and then do a release of that project).

I see arguments for both solutions, and if we prefer to move these two modules to a separate project it works for me.

dslmeinte commented 4 months ago

Is it an idea to provide a separate implementation (including a generator) for Kotlin: lionweb-kotlin?

I like Kotlin, but Java is still a lot bigger than Kotlin. Also: having an extra language that LionWeb is implemented probably has better optics than just lionweb-java which has an intermix of Java and Kotlin.

ftomassetti commented 4 months ago

Also: having an extra language that LionWeb is implemented probably has better optics than just lionweb-java which has an intermix of Java and Kotlin.

Good point. I will close this PR and create lionweb-kotlin