piannaf’s avatarpiannaf’s Twitter Archive—№ 2,790

              1. #TouchlabShare discussing Kotlin/Native's memory model starting now 🚀 @TouchlabHQ/1301925842839203841
            1. …in reply to @piannaf
              First thing to talk about is really exciting Launch of KMM - it's Kotlin Multiplatform, but focused on Mobile, and it's going to alpha blog.jetbrains.com/kotlin/2020/08/kotlin-multiplatform-mobile-goes-alpha/ #TouchlabShare
          1. …in reply to @piannaf
            Another thing, up until Kotlin 1.4, if you were using multithreaded coroutines and ktor there was a big issue that has since been fixed medium.com/@kpgalligan/ktor-and-kotlin-native-fb5c06cb920a #TouchlabShare
        1. …in reply to @piannaf
          Concurrency is one of those things where you get more worried about it the more you learn what can go wrong. #TouchlabShare
      1. …in reply to @piannaf
        Kotlin/Native created a memory model where a single thread could only change state at a time. This was controversial because it would tell you things were wrong at run time and it was different than the JVM, etc. And we wrote about it play.kotlinlang.org/hands-on/Kotlin%20Native%20Concurrency/00_Introduction #TouchlabShare
    1. …in reply to @piannaf
      Roman's post was about how they would change it, but what exactly they will do is not entirely clear. What the post doesn't say is "when" and "what it will be" blog.jetbrains.com/kotlin/2020/07/kotlin-native-memory-management-roadmap/ #TouchlabShare
  1. …in reply to @piannaf
    It's likely not going to be a couple months from now, probably into next year before you can take a look at it. (We've made wrong predictions about what Roman is up to before, but it's based on how much work it'll likely take to change) #TouchlabShare
    1. …in reply to @piannaf
      We expect that there won't be many changes for most developers, at least we expect if you are freezing, you won't need to refactor that. #TouchlabShare
      1. …in reply to @piannaf
        We created a version of KOIN that was immutable on the main thread but if you wanted to get something from a background thread, you'd need a different call. It's easy to freeze something accidentally, and we didn't want to run into those issues. #TouchlabShare
        1. …in reply to @piannaf
          Sqliter is the sqlite driver for native and it's do low level C++ interop with the kotlin native runtime so we'll likely have more work to accommodate the next memory model github.com/touchlab/SQLiter #TouchlabShare
          1. …in reply to @piannaf
            It's nice that ktor is already using multithreaded coroutines but you may run into issues if you aren't prepared for that. What all this means is you probably shouldn't wait for the new memory model #TouchlabShare
            1. …in reply to @piannaf
              When @kpgalligan first saw the new memory model, it felt like going through stages of grief. He first started trying to work around it, then working with it, then accepted it and working effectively with it. So you aren't alone having feelings about it #TouchlabShare
              1. …in reply to @piannaf
                What we had to do before Kotlin 1.4 and the updates to ktor, we needed to hand-deligate cancellation to the child. We used to not use ktor for clients because of that issue. But with the 1.4 changes, we just pushed a PR to a client that uses it now. #TouchlabShare
                1. …in reply to @piannaf
                  How Java fits in? Kotlin is a JVM language, but the Kotlin/Native compiler has nothing to do with JVM. It's also not like Xamarin which has it's own runtime for managing code, memory, and garbage collection. Kotlin/Native implements a kind of reference counting #TouchlabShare
                  1. …in reply to @piannaf
                    What about the main thread? In day to day operation, doing stuff in the main thread normally won't be much of an issue, and as phone hardware changes, it becomes less of a problem, but you still shouldn't. #TouchlabShare
                    1. …in reply to @piannaf
                      Another concern is serialization and inflating to objects happens on the main thread and depending on your production needs, that may be a problem. There are definitely times where you need to compute on the background thread is where multithreaded coroutines #TouchlabShare
                      1. …in reply to @piannaf
                        Does KMM and Android Studio plugin change the purpose of KaMP Kit? There are things KaMP Kit does that is different than defaults. For example cocopods. We see KaMP Kit as a more comprehensive way to get started: libraries, architecture, etc #TouchlabShare
                        1. …in reply to @piannaf
                          Thanks everyone for your questions. Join us next week where we'll be talking to @ankushg from @quizlet #TouchlabShare