mjthornton
04/14/2020, 5:36 PMmjthornton
04/14/2020, 7:37 PMdumptruckman
04/14/2020, 7:40 PMmessages.forEach { message ->
recipients.forEach { recipient ->
val m = messagingService.recordMessage(message, listOf(recipient))
}
}
pniederw
04/15/2020, 3:16 AMuser
04/15/2020, 9:39 AMSam Garfinkel
04/15/2020, 4:30 PMKType
from an Any
(or the corresponding KClass<*>) or am I stuck with only having access to the KClass<*>
?Александр Васильев
04/15/2020, 4:42 PMJiri Bruchanov
04/15/2020, 7:53 PMmjthornton
04/15/2020, 8:15 PMAndrey Stepankov
04/15/2020, 10:32 PMPaul Woitaschek
04/16/2020, 6:35 AMabstract class ReceiverClass {
open fun String.onSomethingHappened(){
println(this)
}
}
class Child : ReceiverClass(){
override fun String.onSomethingHappened() {
super.onSomethingHappened() <-- doesnt compile
println("hello world")
}
}
fatih
04/16/2020, 7:27 AM(String) -> (() -> Unit)
Or is there any side effects?yawkat
04/16/2020, 9:01 AMAhmed Mourad
04/16/2020, 10:09 AMinterface Manager { ... }
class ManagerImpl(...) : Manager {
override fun functionality(): SomeShenanigans {
return Shenanigans.create { ... }
}
...
}
2. Dividing implementation into multiple small functions
interface/typealias Functionality: () -> SomeShenanigans
fun functionalyImpl(): SomeShenanigans = Shenanigans.create { ... }
class ManagerImpl(f: Functionality, ...) : Manager {
override fun functionality(): SomeShenanigans {
return f.invoke()
}
...
}
The former is much more compact but can cause circular dependencies and would require some weird shenanigans to solve, while the later solves the issues with circular dependencies but would require much more boilerplate.Slackbot
04/16/2020, 10:15 AMspand
04/16/2020, 12:31 PMFor library authors
As creating new libraries is vital for the Kotlin ecosystem, we keep improving the experience of library authors. The new library authoring mode will help shape your code in the way that's best for stable APIs. Also, we are going to release Dokka 1.0 to support docs generation for all platforms.
From https://blog.jetbrains.com/kotlin/2019/12/what-to-expect-in-kotlin-1-4-and-beyond/
Can one read about this anywhere ?spand
04/16/2020, 2:14 PM.method(true)
or .method(false)
. I would like to migrate that to .method(SortOrder.ASC)
and .method(SortOrder.DESC)
respectively. Can I do that with @Deprecated
or something similar that can be triggered on an entire project?
(I can easily end up with .method(if(true) SortOrder.ASC else SortOrder.DESC)
but I would like to automate the final step)David Winer [G]
04/16/2020, 5:12 PMmjthornton
04/16/2020, 6:16 PMPeter
04/16/2020, 7:07 PMinline class TypesafeId<T>(val id: Int)
typealias PersonId = TypesafeId<Person>
data class Person(val id: PersonId)
typealias AnimalId = TypesafeId<Animal>
data class Animal(val id: AnimalId)
fun main(args: Array<String>) {
println(Animal(AnimalId(1)))
// println(Person(AnimalId(1))) typecheck fails at compile time
println(Person(TypesafeId(1)))
}
wondering why the last println
compiles successfully?voben
04/16/2020, 7:34 PMstart += 1 // expr1
start++ // expr2
rrva
04/17/2020, 10:35 AMspand
04/17/2020, 12:18 PMkushalp
04/17/2020, 2:48 PMHeader
LineItem
LineItem
Footer
I have written a Grammar<T>
to parse each line of each "type" so far, e.g. Grammar<Header>
. How can I compose these grammars together? The lines are split by newline.Ananiya
04/17/2020, 5:04 PMfun generate(){
println("${randomWord()}${randomKey()}${randomWord()}${randomWord()}${randomKey()}${randomWord()}${randomSymbol()}${randomWord()}${randomSymbol()}")
}
prints String Int String String Int String Char String and Char
respectively and how do i make this code to change it place randomly in every run that can be String String Int String Int Char String Char String
no
04/18/2020, 11:02 AMcarlos cdmp
04/18/2020, 6:30 PMOfir Bar
04/18/2020, 7:52 PMinline fun<reified T> Any.deepCopy(): T {
val JSON = Gson().toJson(this)
return Gson().fromJson(JSON, T::class.java)
}
However, when I try to perform this Deep Copy on a List, the items on the list are LinkedTreeMap
.
Can anyone correct me as what can I possible do to resolve it?Ludwig Groeber
04/19/2020, 10:45 AMvishesh
04/19/2020, 7:07 PM