krenvpravo
09/25/2017, 2:30 PMariff
09/25/2017, 10:19 PMsnowe
09/25/2017, 10:21 PMdhkim
09/26/2017, 3:13 AMSlackbot
09/26/2017, 9:13 AMdragas
09/26/2017, 9:46 AMalexcouch
09/26/2017, 5:56 PMraulraja
09/26/2017, 6:08 PMmortda-m
09/26/2017, 7:52 PMraulraja
09/26/2017, 7:56 PM?
in the function name and since that is a reserved keyword for nullable types it needs to wrap it in backticksagomez
09/26/2017, 8:02 PM<T: IndexedAccess>
sqia09
09/27/2017, 9:10 AMdave08
09/27/2017, 12:32 PMjoelpedraza
09/27/2017, 1:59 PMfinal boolean b;
final double d;
{
final Random rng = new Random();
final double r = rng.nextDouble();
if (r < 0.5d) {
b = false;
d = r / 2;
} else {
b = true;
d = r * 3;
}
// rng and r fall out of scope
}
Is it possible to express this in kotlin? using a run {} "block" is a lambda, and captured value initialization is forbidden.kristofdho
09/27/2017, 2:00 PMjoelpedraza
09/27/2017, 2:24 PMinline fun <reified T> store(texelCoord: Vec3i, layer: Int, face: Int, level: Int, texel: T) {
val blockSize = getSize(T::class)
}
Thanks @marstrankotlin_questions
09/27/2017, 2:42 PMkotlin_questions
09/27/2017, 2:45 PMkotlin_questions
09/27/2017, 2:49 PMkotlin_questions
09/27/2017, 2:53 PMraulraja
09/27/2017, 8:53 PMinline
functions marked as tailrec
can't be recursive in Kotlin. Is that because of fear of inlining too much?. Shouldn't tailrec
take precedence and what gets inline is just a while
loop? Thanks!pakoito
09/27/2017, 10:34 PMpakoito
09/28/2017, 12:00 AMis there built-in support for polymorphic arrays, and sealed classes?
dragas
09/28/2017, 10:28 AMlex
09/28/2017, 10:49 AMjoelpedraza
09/28/2017, 3:36 PMm
09/28/2017, 6:56 PMnerses
09/28/2017, 8:59 PMCollection<Long> values = fetchList();
Long[] valuesAsArray = new Long[values.size()];
values.toArray(valuesAsArray);
Kotlin conversion
val values = fetchList()
val valuesAsArray = arrayOfNulls<Long>(values.size)
values.toTypedArray()
and all elements in valuesAsArray will be nullsnowe
09/28/2017, 10:52 PMPair
a different name for first
and second
when json serializing?gildor
09/29/2017, 8:44 AMclass test {
private var projID: String? = null
fun main() {
projID = intent.getStringExtra(getString("test")).also { projID ->
if (projID != null) {
val proj = Proj(projID)
} else {
// todo
}
}
}
}
gildor
09/29/2017, 8:44 AMclass test {
private var projID: String? = null
fun main() {
projID = intent.getStringExtra(getString("test")).also { projID ->
if (projID != null) {
val proj = Proj(projID)
} else {
// todo
}
}
}
}
Czar
09/29/2017, 8:46 AMfun main() {
val proj = intent.getStringExtra(getString("test"))?.let { projId = it; Proj(it) } ?: //todo
}
gildor
09/29/2017, 8:46 AMtodo