Size: a a a

2019 October 04

I

Igor in Kotlin Start
Alex
Deep dive into coroutines on jvm, Roman Elizarov
спасибо
источник

I

Ivansuper in Kotlin Start
I think it is time for you to read about keyword "reified"
источник

I

Ivansuper in Kotlin Start
What is all this about? What are you trying to accomplish?
источник

MG

Matthew Good in Kotlin Start
i want to try and reduce my duplicate code in https://del.dog/uhipezical.kt
источник

MG

Matthew Good in Kotlin Start
so that its easier to maintain
источник

D

Denys in Kotlin Start
The easiest way to simplify code is to split it into functions. :)
источник

РГ

Расулходжа Ганиев in Kotlin Start
всем привет, помогите пожалуйста,
public class Main {
   public static void main(String args[]) {
 const INTERVAL = 500;
 let counter = 0;
 const MAX_VALUE = 10;
 let timer = NULL;

 const event = () => {
     if (counter === MAX_VALUE) {
         console.log('The end');
         clearInterval(timer);
         return;
       }
       console.dir({counter, date: new Date() });
     counter++;
       };
     console.log('Begin');
     timer = setInterval(event, INTERVAL);
   }
}
```
почему компилятор ругает
источник

РГ

Расулходжа Ганиев in Kotlin Start
вот что покахывает
источник

SB

Siamion Babich in Kotlin Start
Расулходжа Ганиев
вот что покахывает
А давно в джаве константы появились?
источник

RI

Ruslan Ibragimov in Kotlin Start
Это когда учишь джаву, по книжке про JS и спрашиваешь об этом в котлин чате
источник

РГ

Расулходжа Ганиев in Kotlin Start
Ruslan Ibragimov
Это когда учишь джаву, по книжке про JS и спрашиваешь об этом в котлин чате
😅😅
источник

РГ

Расулходжа Ганиев in Kotlin Start
Ruslan Ibragimov
Это когда учишь джаву, по книжке про JS и спрашиваешь об этом в котлин чате
просто попросили узнать про это:)
источник

РГ

Расулходжа Ганиев in Kotlin Start
а так хороший рофл
источник
2019 October 05

MG

Matthew Good in Kotlin Start
why does
   operator fun plus(vector: Vector<Any>): Vector<Any?> {
get called for
   val vv = v1.plus(v2 as Vector<Any>)
and not for
   val vv = v1.plus(v2)

    val v1 = Vector<Byte>(2)
   val v2 = Vector<Long>(2)
источник

AL

Alexander Levin in Kotlin Start
Matthew Good
why does
   operator fun plus(vector: Vector<Any>): Vector<Any?> {
get called for
   val vv = v1.plus(v2 as Vector<Any>)
and not for
   val vv = v1.plus(v2)

    val v1 = Vector<Byte>(2)
   val v2 = Vector<Long>(2)
It depends on variance of Vector. If Vector is invariant (like MutableList), Vector<Any> is not the same thing as Vector<Byte> and casting can cause troubles (However that's possible because of the nature of JVM)

More detailed explanation can be found here: https://kotlinlang.org/docs/reference/generics.html#variance
источник

MG

Matthew Good in Kotlin Start
how do i get it to NOT call this
public operator fun <T> Iterable<T>.plus(
   elements: Iterable<T>
): List<T>
источник

MG

Matthew Good in Kotlin Start
class Vector<Type> : Math, Iterable<Type?> {
...
}
источник

MG

Matthew Good in Kotlin Start
as i get [1, 8, 2, 16] when i am supposed to get [3, 24]
источник

AL

Alexander Levin in Kotlin Start
Matthew Good
how do i get it to NOT call this
public operator fun <T> Iterable<T>.plus(
   elements: Iterable<T>
): List<T>
If that's applicable for your Vector class, you can start with Vector<out Type> (make your type covariant)
источник

MG

Matthew Good in Kotlin Start
welp *removes iterable*
источник