Marko Mitic
08/05/2019, 7:03 PMMichael
08/05/2019, 8:28 PMvitus
08/05/2019, 8:56 PMAnimesh Sahu
08/06/2019, 4:29 AMAntanas A.
08/06/2019, 9:08 AMval context by lazy { contextProvider() }
where contextProvider() is suspend functionOnur
08/06/2019, 2:37 PMxPath
and contextString
private?Max Spencer
08/06/2019, 3:47 PMkotlin.native.IncorrectDereferenceException: Trying to access top level value not marked as @ThreadLocal or @SharedImmutable from non-main thread
The context is quite convoluted and I'm not sure if it is relevant or not. I can elaborate further if anyone thinks it might help, but briefly:
I've created a Kotlin Multiplatform library (see https://github.com/guardian/multiplatform-ophan) which can send various "events" to an analytics service called "Ophan".
I've come up with a way to implement "Native Modules" for React Native applications using shared Kotlin Multiplatform code (see https://github.com/guardian/react-native-with-kotlin)
Now I'm trying to put these two ideas together. But unfortunately, although the multiplatform-ophan
library works as expected when consumed directly from Android or iOS, I run into the above exception on iOS when it is included in a React Native app via this extra layer of indirection.
I don't expect anyone to help me debug this issue if it's anything to do with React Native and I appreciate you might think this seems like a very odd combination of things to be doing. But even just some general pointers about the kind of pitfalls you might expect in this area would be greatly appreciated.Luis Munoz
08/06/2019, 4:43 PMNezteb
08/06/2019, 6:18 PMinline fun <T, R> with(receiver: T, block: T.() -> R): R {
return receiver.block()
}
inline fun <T> T.also(block: (T) -> Unit): T {
block(this)
return this
}
inline fun <T> T.apply(block: T.() -> Unit): T {
block()
return this
}
inline fun <T, R> T.let(block: (T) -> R): R {
return block(this)
}
inline fun <T, R> T.run(block: T.() -> R): R {
return block()
}
What does the T.() -> R
imply? I know (T) -> R
is a function that takes a T
and returns an R
, but what does T.()
mean?Ankur Gupta
08/07/2019, 4:31 AMclass TeaMaker {
private lateinit var tea: Tea
fun prepareTea() {
tea = Tea()
}
fun addSugar() {
tea.add(Sugar())
}
}
class Restaurant {
...
//In some method
val teaMaker = TeaMaker()
teaMaker.prepareTea()
teaMaker.addSugar()
}
The problem is when i call addSugar I get the lateinit not initialized exception. I tried setting up debugger but found it is initialised. Am I missing something?Vishal
08/07/2019, 5:42 AMbin
folder is not getting generated in SharedCode/build
folderTsvetozar Bonev
08/07/2019, 10:38 AMSlackbot
08/07/2019, 2:35 PMFelipe Tavares
08/07/2019, 2:50 PMProcess 'command '/usr/lib/jvm/java-11-openjdk-amd64/bin/java'' finished with non-zero exit value 1
Can someone help me please?wathek
08/07/2019, 5:07 PM// First method
val test = Mono.just("hello").run { block() }
// Second method
val test = Mono.just("hello").block()
Both cases test
has String?
typeJon
08/07/2019, 11:14 PMjermainedilao
08/08/2019, 7:51 AMval list = mutableListOf<String>()
variable list
will be a mutable list.
but if I have
val list: List<String> = mutableListOf<String>()
variable list
will be an immutable list.
Can someone explain the hierarchy here? Is the defined variable data type always becomes the winning data type?bhavin
08/08/2019, 9:01 AMvar getVideoList: ArrayList<Any>
look at this my code https://paste.ofcode.org/PpCQuDjkAvtKpv7U29k7cDLuis Munoz
08/08/2019, 3:48 PMAdam Spofford
08/08/2019, 5:16 PMHarsh Deshpande
08/08/2019, 5:23 PMspierce7
08/08/2019, 5:25 PMobject Example {
fun String.exampleExtension() {
}
}
fun test(str: String) {
str.exampleExtension() // Doesn't work. How can I use the extension function?
}
Gunslingor
08/08/2019, 7:05 PMMike R
08/09/2019, 2:50 AMNikky
08/09/2019, 5:11 AMval nullable = platformTypeVariable ?: null
the correct way to tell Kotlin that a platform type is nullable ?Slackbot
08/09/2019, 2:03 PMsdeleuze
08/09/2019, 2:52 PMNezteb
08/09/2019, 4:32 PMJon
08/09/2019, 10:31 PMasad.awadia
08/10/2019, 12:37 AMasad.awadia
08/10/2019, 12:37 AMjw
08/10/2019, 1:00 AMsuspend fun main() = suspendCoroutine { }
will run forever and never crash unless it's due to outside factors