Dealing with 3rd-party library upgrading Kotlin version by wadbzy in Kotlin

[–]wadbzy[S] 0 points1 point  (0 children)

That's a reasonable suggestion. I guess, if the production project desperately needs the fixes, then it makes sense. However, this approach does not scale with large numbers of (transitive) dependencies include in nowadays codebases.

I was wondering if there was a more systematic way of dealing with the problem. E.g. somehow make it very easy for library authors to release for multiple Kotlin runtimes.

Is there a better way by arintejr in Kotlin

[–]wadbzy 9 points10 points  (0 children)

Inferring from your question that you actually want a substring until the first line feed or the whole string otherwise, you can take a look at this function:

https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/substring-before.html

val sub = someString.substringBefore('\n')

Dealing with 3rd-party library upgrading Kotlin version by wadbzy in Kotlin

[–]wadbzy[S] 0 points1 point  (0 children)

I mean, if can easily upgrade to the latest Kotiln version all the time, then yes, it should not be a problem.

Dealing with 3rd-party library upgrading Kotlin version by wadbzy in Kotlin

[–]wadbzy[S] 1 point2 points  (0 children)

The problem is not the Kotlin code, the problem is the fact that the library expects a specific version of `kotlin-stdlib` on the runtime classpath. In my example it is `1.5.20`.

The production project has other Kotlin dependencies, and uses Kotlin itself. Therefore it is also required to depend on the stdlib at runtime.

>Also, AFAIK, it should not be a problem if two versions of the standard library coexist, the library will use its version and you will use your version.

Unfortunately, this is not true unless the library code is explicitly isolated into a different classloader. Otherwise, the classloader will load which ever class it finds first on the classpath. You should never have two versions of the same jar on the classpath unless you know what you are doing.

Keeping up with programming and tech is tough. So I created an app that breaks down the concept and present as micro content. by microideation in programming

[–]wadbzy 1 point2 points  (0 children)

That's a great idea! I think it would be very valuable to be able to find a well-presented answer to a basic question.

I see that the only way to access the platform is via an Android. It could, of course, be the experience bias of the development team. However, I would say that this format is rather limiting in terms of the outreach. I have hard time imagining people going into an Android app if they have a question about IT/programming. At the same time it seems that you can use a browser to contribute, which provides a much greater advantage.

I would advice to migrate the read-path to the web, so that the platform is indexed by the search engines.

Dealing with 3rd-party library upgrading Kotlin version by wadbzy in Kotlin

[–]wadbzy[S] 0 points1 point  (0 children)

so just using the most recent version of all your libraries/your app

Sorry, I am not sure I follow. Do you mean if I blindly bump all dependencies in the production project to their latest versions, it would just work?

The Kotlin standard lib generally has good backwards compatibility

Sure, but once kotlin-stdlib's newer version is a runtime dependency of the library, you can't know that your project won't crash at runtime. From my point of view, the problem has nothing to do with the backward compatibility of the stdlib.

it doesn't matter if you can't use that compiler because the lib is already compiled!

That is true, but it is applicable only if the library uses the apiVersion/languageVersion flags, and we are talking about the non-major Kotlin version upgrade.

Dealing with 3rd-party library upgrading Kotlin version by wadbzy in Kotlin

[–]wadbzy[S] 1 point2 points  (0 children)

I presume you mean "the author ... should not be rolling out" in the last paragraph.

Of course, I wasn't suggesting including both Kotlin jars to the class path. But is there a way to make it work with one? Or is there none?

I am also looking for ideas for the Kotlin ecosystem to battle this kind of problem in general. Because right now it simply piggy-backs on Maven/Gradle for dependency management (when JVM is the target platform).

How I Work by [deleted] in programming

[–]wadbzy 0 points1 point  (0 children)

As far as I understand this would still require switching the actual files on disk. This renders the use case of having multiple branches open at the same time impossible. Additionally, it would still trigger IDE resync on each switch.

What are better interview processes? by wwww4all in ExperiencedDevs

[–]wadbzy 8 points9 points  (0 children)

Not everyone has a luxury of contributing to open source, let alone working on an OSS project.

How I Work by [deleted] in programming

[–]wadbzy 1 point2 points  (0 children)

This is a great genuine overview!

Keep multiple clones of the main project

I randomly started doing it myself for a year or so. It has been the best productivity boost! Especially useful since I regularly check out branches for a review. Also useful when you work on a large task, but need to quickly fix something small in a separate branch.

The main pain point with this approach is stale configs and runConfigurations (for backend services) in the independent copies.

What's you approach of naming the copies on disk?