Sourabh Rawat
10/26/2020, 10:07 AM@Serializable
data class ApiResponse<T>(
val result: T? = null,
val error: ApiError? = null
)
call.respond(ApiResponse(result = gameEngine.newGame()))
But this does:
@Serializable
class Foo(val bar: ApiResponse<String>)
call.respond(Foo(ApiResponse(result = gameEngine.newGame())))
Using ktor + serialization
My question is why? and how can i achieve the first one.
I am getting Serializer for class 'ApiResponse' is not found
for 1st approachrkeazor
10/26/2020, 11:13 AMNir
10/26/2020, 2:05 PMBig Chungus
10/26/2020, 5:07 PMJosé Vicente Cruz
10/26/2020, 5:10 PMhttps://www.youtube.com/watch?v=-y2vW94mBDE&t▾
ahmad abas
10/27/2020, 5:26 AMjetpack compose
. It seems like an amazing tools. When will it be production ready, v1.0?3bdoelnaggar
10/27/2020, 11:05 AM@Entity(tableName = "logs")
data class Log(@PrimaryKey(autoGenerate = true)
var id: Long = 0,val msg: String, val timestamp: Long)
and
@Entity(tableName = "logs")
data class Log(val msg: String, val timestamp: Long) {
@PrimaryKey(autoGenerate = true)
var id: Long = 0
}
KamilH
10/27/2020, 1:12 PMbuildSrc
module in regular code (not build.gradle
files)? I’ve got some strings declared there that I would like to access in runtimeAnimesh Sahu
10/27/2020, 3:26 PMBig Chungus
10/27/2020, 9:30 PMJason5lee
10/28/2020, 2:02 AMJ6ey
10/28/2020, 4:23 AMguard let type = model.type, let value = model.value, value != 5 else {
return
}
spierce7
10/28/2020, 5:20 AMreact native
has a similar trend. I’m just curious what would cause a sudden down-spike like that.Hexa
10/28/2020, 7:33 AMSaul Wiggin
10/28/2020, 9:43 AMMartin Barth
10/28/2020, 10:14 AMakuleshov7
10/28/2020, 10:17 AMMarc Reichelt
10/28/2020, 3:23 PMthanksforallthefish
10/29/2020, 9:17 AMcopy
and equals
and being able to have an interface would help me doing the refactor incrementally. eg:
interface Test {
val field: String
fun copy(field: String)
}
data class TestData(override val field: String) : Test
but ofc this does not compile. I don’t think it is really doable, but hope is the last to die they say 🙂Marshall
10/29/2020, 2:37 PMclass C {
private val _elementList = mutableListOf<Element>()
val elementList: List<Element>
get() = _elementList
}
Taken from https://kotlinlang.org/docs/reference/coding-conventions.html#property-namesMartin Barth
10/29/2020, 2:52 PMfun convertMaybe(record: Record?): DataObject? {
return if (record != null) converter.buildDataObject(record) else null
}
ursus
10/29/2020, 9:37 PMenum class Parent.Child {
BAR, QUAX
}
where Parent is generated, so I cannot put the Child there directlyDaniel
10/29/2020, 10:40 PMuser
10/30/2020, 9:13 AMJukka Siivonen
10/30/2020, 12:57 PMmbonnin
10/30/2020, 1:56 PMmutableMapOf()
to preserve iteration order on key re-insertion like a LinkedHashMap ?platypusguy
10/31/2020, 3:05 AMAfzal Najam
10/31/2020, 3:09 AMalways
in a when block? Like
when (something) {
FIRST_CASE -> doThis()
SECOND_CASE -> doThat()
else -> doSomethingElse()
always -> andAlwaysDoThis()
}
I mean, sure, we can just write the always part outside of the when block but not when it's an expression body.
Just wondering.Ananiya
10/31/2020, 9:03 AMbod
10/31/2020, 3:37 PMget
of the delegated property is called at init time. So in a sense, these 2 constructs don't do the same:
// old way: wrapped.a is called only when this.a is called
val a: Boolean get() = wrapped.a
// new way: wrapped.a is called when this.a is called but also right here at init
val a by wrapped::a
Is this correct / intended or am I missing something?bod
10/31/2020, 3:37 PMget
of the delegated property is called at init time. So in a sense, these 2 constructs don't do the same:
// old way: wrapped.a is called only when this.a is called
val a: Boolean get() = wrapped.a
// new way: wrapped.a is called when this.a is called but also right here at init
val a by wrapped::a
Is this correct / intended or am I missing something?Animesh Sahu
10/31/2020, 4:36 PM