Size: a a a

2019 October 04

AM

Andrew Mikhaylov in Kotlin Start
Matthew Good
and also why does Byte + Byte give Int instead of Byte
Because JVM.
источник

AM

Andrew Mikhaylov in Kotlin Start
There are no byte operations in JVM bytecode, everything is extended to int under the hood.
источник

AM

Andrew Mikhaylov in Kotlin Start
Long is another story, of course, that's why it got own handling.
источник

MG

Matthew Good in Kotlin Start
why not just cast back to Byte?
источник

MG

Matthew Good in Kotlin Start
such that (Byte + Byte).toByte()
источник

D

Denys in Kotlin Start
Matthew Good
basically if Byte + Byte gives Int, why doesnt Long + Long give anything higher than Long
If you don't care about performance too much - try using BigInteger/BigDecimal.
BigInteger - N years on not-giving-a-fuck-about-overfloating market.
источник

AM

Andrew Mikhaylov in Kotlin Start
Matthew Good
why not just cast back to Byte?
I guess that's because shorts and bytes are quite infrequent in JVM world, so these trimmings won't get you much of a profit.
источник

I

Ivansuper in Kotlin Start
Andrew Mikhaylov
Because JVM.
In JVM you will still get byte as a result in the sake of type consistency
источник

MG

Matthew Good in Kotlin Start
Andrew Mikhaylov
I guess that's because shorts and bytes are quite infrequent in JVM world, so these trimmings won't get you much of a profit.
ok
источник

I

Ivansuper in Kotlin Start
I came to the Kotlin chat with the exact same problem a while ago. This is just the way Kotlin does its math
источник

AM

Andrew Mikhaylov in Kotlin Start
Ivansuper
In JVM you will still get byte as a result in the sake of type consistency
Really? That's nice to know. Then I don't know the answer to Matthew question.
источник

D

Denys in Kotlin Start
And on JVM level Byte/Short is still stored as Integer.
источник

I

Ivansuper in Kotlin Start
Denys
And on JVM level Byte/Short is still stored as Integer.
Stored -- depends. Processed -- yes
источник

MG

Matthew Good in Kotlin Start
also if the result of a Byte operation will cause overflow (eg Byte.MAX + Byte.MAX) should it be promoted to a larger type capable of holding the result depending on the operation (eg + vs * ) (with the exeption in which the result exceeds the largest possible type, eg greater than 64 bits, eg Long.MAX + 1 cannot be promoted to a 128 bit type as no such type exists thus would be required to overflow)
источник

I

Igor in Kotlin Start
Ребят а где можно детальнее посмотреть что такое корутина, то есть что под капотом у Job? Почему корутина light-weight thread?
источник

M

Malik in Kotlin Start
Лекции Романа Елизарова посмотри
источник

A

Alex in Kotlin Start
Igor
Ребят а где можно детальнее посмотреть что такое корутина, то есть что под капотом у Job? Почему корутина light-weight thread?
Доклады Ромы Елизарова  поищи на Ютубе
источник

I

Igor in Kotlin Start
Alex
Доклады Ромы Елизарова  поищи на Ютубе
смотрел, но там нет таких деталей, как они все-таки внутри работают, может ещё не все перемотрел
источник

M

Malik in Kotlin Start
У него их несколько, в каком-то одном он залезал немного под капот
источник

A

Alex in Kotlin Start
Igor
смотрел, но там нет таких деталей, как они все-таки внутри работают, может ещё не все перемотрел
Deep dive into coroutines on jvm, Roman Elizarov
источник