jw
02/25/2019, 5:01 PMstreetsofboston
02/25/2019, 9:26 PMwhen
with
or `run`… not sure… a matter of taste, in my opinion 🙂liminal
02/26/2019, 2:35 AMJeremy
02/26/2019, 9:02 AM// scala
sealed trait Test[+A] {
…
def test[B >: A]: B
…
}
// kotlin
Sealed class Test<out A> {
…
fun <A : B> test(): B. // <— this is problem
…
}
I want to make type B is a super type of A. Anyone who knows this problem??edwardwongtl
02/26/2019, 9:22 AMfun <A, B> test(): B where A: B
Jeremy
02/26/2019, 9:34 AMnatpryce
02/26/2019, 11:16 AMRob
02/26/2019, 2:13 PMoverride fun toString(): String {
return super.toString()
}
in each of the subclasses?karelpeeters
02/26/2019, 3:46 PMPair
and Triple
, but I'm curious about what you mean by "bulky". data class Point(val x: Int, val y: Int)
isn't a lot of code.Joe
02/26/2019, 5:38 PMMap<String, (Int)->Boolean>
and a Map<String, (String)->Boolean>
. I'd like to combine them to get a Map<String, (Any)->Boolean>
, but can't quite figure out how to do so safely. I can safely cast to Map<String, *>
or Map<String, Any?>
without an unchecked cast warning, but I can't safely cast to `Map<String, (*)->Boolean>`(compile error) or Map<String, (Any?)->Boolean>
(unchecked cast)awzurn
02/27/2019, 12:18 AMscala> case class Something[T](something: T)
defined class Something
scala> Something(1)
res0: Something[Int] = Something(1)
scala> res0.copy(something = "something")
res1: Something[String] = Something(something)
Kotlin, on the other hand, won’t compile something like this:
data class Something<T>(val value: T)
Something(1).copy("something")
I’m wondering if it was an explicit design decisions, or maybe something that just hasn’t been implemented yet?David Cuesta
02/27/2019, 8:25 AMimport kotlinx.coroutines.delay
suspend fun first(a: Int): Int {
delay(100)
return a + 1
}
suspend fun testMap(a: Map<String, Int>): Int {
a.forEach { key, value ->
first(value)
println(value)
}
return 0
}
suspend fun testList(a: List<Int>): Int {
a.forEach {
first(it)
println(it)
}
return 0
}
Edgars
02/27/2019, 11:04 AMlouiscad
02/27/2019, 1:58 PMjvmTarget
?
> Task :some-android-lib-module:compileDebugKotlin FAILED
e: Unknown JVM target version: 1.7
Supported versions: 1.6, 1.8
David R.
02/27/2019, 2:31 PMLamberto Basti
02/27/2019, 3:00 PMLeoColman
02/27/2019, 4:04 PMhudsonb
02/27/2019, 11:51 PMNikolai
02/28/2019, 4:53 AMDaniel Eke
02/28/2019, 8:27 AMSQLDelight
? I have a bunch of questions but I don’t want to bombard them with issues. 😄JoakimForslund
02/28/2019, 8:35 AMJulien Genoud
02/28/2019, 11:51 AMinline
i still don't understand it ... thankss1m0nw1
02/28/2019, 1:52 PMobject
in my application, what might be the issue? Seems to be possibleAndrew Gazelka
02/28/2019, 3:30 PMAndrew Gazelka
02/28/2019, 4:34 PM1.3.21
)CLOVIS
02/28/2019, 5:31 PMAndrew Gazelka
03/01/2019, 12:21 AMtipsy
03/01/2019, 6:56 AMjava.lang.IllegalStateException: Resource not found in classpath: kotlin/coroutines/coroutines.kotlin_builtins
intermittently in a tests that use to work fine. it only seems to happen on windows (build seems to work on linux consistently, and it's never failed on travis). has anyone run into this?mbonnin
03/01/2019, 10:36 AMcatch
clauses. For an example IOExceptions on files/connections that made the app crash while we should have just shown an error screen.
We were considering removing exceptions altogether from our codebase and just rely on return values. Legacy java dependencies like File
would still need catch
blocks and that's okay. But then we realized that even new libs like retrofit-coroutines throw exceptions.
How are you handling this ? Do you have a lot of exception handling in your codebases or do you use return values ? Is it okay for kotlin libs to throw non-fatal exceptions ?mmaillot
03/01/2019, 12:50 PMmmaillot
03/01/2019, 12:50 PMdiesieben07
03/01/2019, 12:53 PMinline fun <reified E : Enum<E>> randomValue(): E {
return randomValue(E::class.java)
}
fun <E : Enum<E>> randomValue(cls: Class<E>): E {
return cls.enumConstants.random()
}
val rnd = randomValue<Foo>()
// or
val rnd = randonValue(Foo::class.java)
mmaillot
03/01/2019, 12:56 PMMark McCormick
03/01/2019, 1:14 PMYourEnumClass.values().withIndex().shuffled().first().value
diesieben07
03/01/2019, 1:15 PMDico
03/02/2019, 1:23 PMenumValues<E>().let { it[Random.nextInt(size)] }