ckchen
11/03/2018, 12:44 PMcoroutineContext[Job]. Isn’t Job an interface? Why can it be used for indexing? I have checked the source (public operator fun <E : Element> get(key: Key<E>): E? of CoroutineContext) and still don’t have a clue.karelpeeters
11/03/2018, 12:49 PMCtrl+B on Job?ckchen
11/03/2018, 12:50 PMpublic interface Job : CoroutineContext.Elementckchen
11/03/2018, 12:53 PMJob is an interface, not an instance of Key<E>. Why can it be passed to public operator fun <E : Element> get(key: Key<E>): E?karelpeeters
11/03/2018, 12:54 PMelizarov
11/03/2018, 12:57 PMelizarov
11/03/2018, 12:58 PMkarelpeeters
11/03/2018, 1:01 PM[Job]?ckchen
11/03/2018, 1:04 PMpublic companion object Key : CoroutineContext.Key<Job> in Job. So, why not coroutineContext[Job.Key]?elizarov
11/03/2018, 1:05 PMJob.Key. But since Key is a companion object to Job, simply using Job works, too.ckchen
11/03/2018, 1:06 PMkarelpeeters
11/03/2018, 1:08 PMckchen
11/03/2018, 1:11 PMelizarov
11/03/2018, 3:31 PMckchen
11/04/2018, 12:52 AM