statmark56
09/01/2022, 2:48 PMsealed class Element<T>(val value: T)
object Test : Element(10) // expecting compiler somehow able to refer the implicit integer 10 value to resolve T
But actually need to explicitly declare the argument type to satisfy the compiler:
object Test : Element<Int>(10)
Any reason why? Thank you.Nick
09/01/2022, 5:46 PM1.7.0
and 1.4.32
. Is there any possibility that there could be some sort of conflict since the versions are different? What about a similar situation with something like Jetpack Compose or Koin?Rob Elliot
09/02/2022, 8:18 AMinit
block entirely lazy? Example in the thread.
(I suspect I'm going to get "smells of a poor design" and that may well be right but my imagination is failing me on how to fix it at the moment...)oday
09/02/2022, 9:23 AMsealed interface EmptyResult {
object Success : EmptyResult
class Failure(val error: Throwable) : EmptyResult
}
sealed class DeleteResult : EmptyResult
sealed class SetResult : EmptyResult
Why can’t I access SetResult.Success or DeleteResult.Success?NelsonC
09/02/2022, 12:47 PMYogeshvu
09/02/2022, 3:52 PMrednifre
09/02/2022, 5:18 PMzt
09/03/2022, 7:55 AMegek
09/03/2022, 10:58 AMHassaan
09/03/2022, 1:00 PMvar num = 0
println(--num + num++) // equals to -2 instead of 0
NelsonC
09/03/2022, 6:46 PMrednifre
09/03/2022, 8:06 PMMateusz Konieczny
09/05/2022, 4:17 PMelse
branch even if not needed in Kotlin 1.7?
See say https://github.com/streetcomplete/StreetComplete/commit/1972a7139bff92e894474d1d3d1969b83da2d375
For example
private fun wat(element: StackUnderflow) {
when (element) {
is Unicorn -> {}
is Multicorn -> {}
else -> {}
}
}
requires useless else
where
sealed class StackUnderflow
sealed class Unicorn(val surface: Surface) : StackUnderflow()
sealed class Multicorn : StackUnderflow()
sealed class Tricorn(val surface: Surface) : Multicorn()
sealed class Doublecorn(val surface: Surface) : Multicorn()
is imported from another file.Laurent Laborde
09/05/2022, 4:27 PMLaurent Laborde
09/05/2022, 6:25 PMmarlonlom
09/05/2022, 10:23 PMreified
in a function that, when using a generic function, shows a compiler error message?
The compile error message:
Cannot use 'T' as reified type parameter. Use a class instead.
Laurent Laborde
09/06/2022, 5:37 AMSeniorZhai
09/06/2022, 9:03 AMif-else-if-else
Siegfried Kiermayer
09/06/2022, 4:24 PM@Named("approvals")
@Inject
Process<? extends Model> approvalsProcess;
When i try the same thing in Kotlin, i'm only getting an
[error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.AmbiguousResolutionException: Ambiguous dependencies for type org.kie.kogito.process.Process<? extends org.kie.kogito.Model> and qualifiers [@Default]
exception.
The same constructor injection 'way' actually works:
@ApplicationScoped
class FooBar (
@Named(value = "approvals")
private val approvalsProcess: Process<out Model>
){
But now i need to do the injection in my Test class for a unit test and i can't use this as its not allowed. only propery assignment is allowedSiegfried Kiermayer
09/06/2022, 4:50 PM@field: Named(value = "approvals")
actually works. No clue what this should doTeimatini Marin
09/06/2022, 10:51 PMFan-out
Multiple coroutines can receive from a single channel; however, to receive them properly we should use a for-loop (consumeEach is not safe to use from multiple coroutines)
I wonder if this statement regarding consumeEach is still accurate? In which sense it is not safe?PoisonedYouth
09/07/2022, 7:21 AMval result = myList
.filter { it.nullableProperty != null }
.map { it.nullableProperty!!.fromAccount }
Why do I have to use the non-null asserted call in the map step?y
09/07/2022, 8:22 AMtry-catch
idiomatic in Kotlin?Yusuf.I
09/07/2022, 8:18 PMzt
09/08/2022, 12:31 AMJari Tuikka
09/08/2022, 12:08 PMy
09/08/2022, 2:03 PMfilterNotNull().filter { //… }
with one function?y
09/08/2022, 2:04 PMfilter_map()
from, say, Rust?sreich
09/08/2022, 6:39 PMThomas Dziedzic
09/08/2022, 8:37 PM