LastExceed
08/25/2019, 9:13 AMShort
and Byte
?gumil
08/25/2019, 10:54 AMSlackbot
08/25/2019, 2:36 PMsynhershko
08/25/2019, 9:09 PMAlexander Shustanov
08/26/2019, 6:27 AMPaul Woitaschek
08/26/2019, 8:10 AMkaptGenerateStubsDevKotlin
even though I only have kapAndroidTest
, kaptRelease
and kaptDebug
in my gradle file.elect
08/26/2019, 12:57 PMval
interface field will be initialized exactly only once?Sam Schilling
08/26/2019, 4:13 PMelect
08/26/2019, 4:55 PMIntBuffer
, I'm writing an extension function for an Enum, where its companion object extends a specific interface. But if I cast, the compiler says the cast can never succeed.. why?
fun <E> Enum<E>.bind() where E : Enum<E>, E : A = (Enum.Companion as B).buffers[ordinal].bind() // this cast can never succeed
Shashank
08/26/2019, 5:22 PMrunBlocking {
val one = async { function1() }
val two = async { function2() }
one.await()
}
Even though I just call one.await()
I see that function 2 is executed as well? Can anyone explain why is it so? I was under the impression that calling await()
is what triggers the execution.molikuner
08/26/2019, 5:32 PMVishal Rana
08/26/2019, 6:00 PMjavac
compiles hello world program in 500ms, is there a reason why does kotlinc
takes 3 s? Is there any way I can improve this? I heard about kotlinc daemon but could not find any documents to get started.Ifvwm
08/27/2019, 3:56 AMSaiedmomen
08/27/2019, 5:15 AMfun fetchData(page=0) {...}
to a function that expects a function with no argument like?
fun runRequest(block: ()->Unit)
Paul Woitaschek
08/27/2019, 6:56 AMenum class BaseNutrient
-> Map<BaseNutrient, Double>
. Is there a more elegant way than using Basenutrient.values().associate { baseNutrient -> baseNutrient to 0.0 }
As I need that so frequently it feels like I’m overseeing sth in the stdlibelect
08/27/2019, 9:28 AMgoku
08/27/2019, 1:32 PM0.0 == -0.0
but I wasn’t expecting to see that in a multiplication 🤔ribesg
08/27/2019, 2:35 PMMap<String, String?>
for a parameter requiring type Map<Any?, *>
?Fin
08/28/2019, 6:36 AMMichal Klimczak
08/28/2019, 6:56 AMprivate val fragmentInjectors = listOf<Pair<Class<out Fragment>, Fragment.() -> Unit>>(
MainControlFragment::class.java to fun Fragment.(){
(this as MainControlFragment).viewModelFactory = mockViewModelFactory
}
)
but ideally I would like something like
private val fragmentInjectors = listOf<Pair<Class<out Fragment>, Fragment.() -> Unit>>(
MainControlFragment::class.java to fun MainControlFragment.(){
this.viewModelFactory = mockViewModelFactory
}
)
to avoid casting. But unfortunately compiler complains about type inference failed, expected type mismatch
because of MainControlFragment and Fragment being different types. Anyone knows the right syntax?thana
08/28/2019, 3:11 PMLuis Munoz
08/28/2019, 3:22 PMTravis Griggs
08/28/2019, 5:21 PMSam Garfinkel
08/28/2019, 5:25 PMCollection<T>
? Use case is a property delegate where getValue
returns Collection<T>
when the type of the val
is Collection<T>
. I.e. val foo: Collection<String> by bar
.corneil
08/28/2019, 7:05 PMcontract
will be able to ensure that if you do precondition(someThing != null) { "Something is required" }
that someThing
be detected as not null afterwards? Is this in the works?Marian Schubert
08/28/2019, 7:51 PMinterface Foo<T> { fun bar(x: Any): Boolean { ... } }
- is there some way to return true from bar if x is instance of T?edwinRNDR
08/28/2019, 8:14 PMShan
08/28/2019, 10:59 PMResponseResult
is getting erased and how I can avoid it?Miguel Vargas
08/29/2019, 1:04 AMsuspend
functions. The keyword is not very well documented but it does say that they can only be used from a coroutine. But then I ran into sequence's yield()
which is a suspend function that it is called from a SequenceScope which is not a coroutine scope. As far as I know Sequences have been in Kotlin 1.0 so it precedes coroutines? I guess I'm trying to get a more basic understanding of suspend functions.bjartek
08/29/2019, 7:24 AMbjartek
08/29/2019, 7:24 AMCasey Brooks
08/29/2019, 1:49 PMRichard Green
08/29/2019, 3:51 PMbjartek
08/29/2019, 3:53 PM