Olekss
10/02/2017, 12:49 PMpokkeli
10/02/2017, 2:57 PMjcogilvie
10/02/2017, 3:13 PMvar foo: Int
get() = something
private set(value) { something = value }
jcogilvie
10/02/2017, 3:14 PMrwachol
10/02/2017, 3:17 PMkristofdho
10/02/2017, 3:23 PMvar foo by delegate
private set
jaguililla
10/02/2017, 3:23 PMval
instead a var
Paul Woitaschek
10/02/2017, 3:45 PMjaguililla
10/02/2017, 3:48 PMbeholder
10/02/2017, 6:40 PMval s = SomeClass::setSomething
). Is it possible to get reference for Kotlin class setter without reflection library?pniederw
10/02/2017, 7:08 PMbeholder
10/02/2017, 7:12 PMval property = KotlinClass::someProperty
val setter = property::set
or even weirder:
val setter = (KotlinClass::someProperty)::set
But it by the cost of generation of extra anonymous classbgoetzmann
10/02/2017, 8:16 PMnode
in GroovyFX, e.g. in this example: https://github.com/groovyfx-project/groovyfx/blob/master/src/site/resources/example/CustomNodeExample.groovy)?kevinmost
10/02/2017, 8:19 PMbgoetzmann
10/02/2017, 8:35 PMwrapper
!kevinmost
10/02/2017, 9:10 PMOlekss
10/03/2017, 7:59 AMCzar
10/03/2017, 8:13 AMOlekss
10/03/2017, 8:14 AMCzar
10/03/2017, 8:17 AMCzar
10/03/2017, 8:19 AMjmfayard
10/03/2017, 10:44 AMfun base64(file: File) : String {
check(file.canRead())
Buffer().use { buffer ->
Okio.source(file).use { source ->
buffer.writeAll(source)
}
return buffer.readByteString().base64()
}
}
marstran
10/03/2017, 10:55 AMOkio.source(file)
though. Your example would not if Buffer()
returned null.marstran
10/03/2017, 11:26 AMc2
if c1
crashes while it closes.user
10/03/2017, 11:27 AMdimsuz
10/03/2017, 11:31 AMsealed class Data
class StructuredData : Data()
data class GenericData(val payload: Int) : Data()
is less optimal than following:
sealed class Data
object StructuredData : Data()
data class GenericData(val payload: Int) : Data()
I often see object
used in these situations, was curious what are the pros of this approach. Tighter bytecode?felix
10/03/2017, 11:33 AMclass
implies that it must be instantiated. object
, however, is just a singleton which is instantiated once.dimsuz
10/03/2017, 11:34 AMnew
...