igor.wojda
01/27/2017, 11:17 AMlateinit
with immutable (val) properties or is it just deliberty forced limitation?
I wonder becouse this limitation does not allow to define non nullable variable that will be initialized latter only once.
Now we can only have mutable injected variables witch can be latter changed by accident (val + lateinit would solve this issue)
Now: @Inject lateinit var repository: Repository
Want: @Inject lateinit val repository: Repository
//initialization is delayed but it is still possible assign value only oncecedric
02/01/2017, 3:06 PMvarargs
with size seems pretty obscure for deserving a language construct. Leave that at runtime.benleggiero
02/02/2017, 1:30 AMfun Array<*>.myInterfaceFunction() {}
?elect
02/03/2017, 8:10 AM[]
operator on `Buffer`s?zokipirlo
02/03/2017, 8:24 AMaimozg
02/04/2017, 9:16 PMlet
, apply
etc always make feel uncomfortable and I just have to double check it has @InlineOnly inline /* don't worry it won't create anonymous class filled with reflection*/ fun
signature...aimozg
02/07/2017, 4:14 PMattachments.fold(attachments as Collection<String>?){ arr, it -> if (it == null) null else arr }
voddan
02/07/2017, 6:52 PMvoddan
02/07/2017, 7:55 PMbenleggiero
02/07/2017, 8:49 PMfor (x in y) {
// Code that might break
} else if break {
// If the loop exited via a break
} else if !break {
// If the loop exited normally (no break)
} else {
// If the loop was never entered
}
orangy
02/07/2017, 9:24 PMgroostav
02/10/2017, 10:36 PMwhere
function would take an AST representation of the body --effectively it takes source code, and then transcompiles the AST for it.name == "bob"
into WHERE c.name == bob
, of the equivalent mongo thing (iirc something resembling {"where" { eq { field { "fname" }, "bob" }}
groostav
02/10/2017, 10:50 PMaimozg
02/10/2017, 11:41 PM+
is "shortest way to call an extension function in a context"dmitry.petrov
02/13/2017, 10:08 AMbenleggiero
02/13/2017, 2:58 PMpublic private(set) var a
groostav
02/15/2017, 6:50 PMsksk
02/19/2017, 8:30 PMpartial class
in C# ?benleggiero
02/26/2017, 9:24 PMwhen
should know when it's been exhaustive if it's evaluating a `sealed class`'s KClass
. For instance:
sealed class MySealedClass {
class SubclassA: MySealedClass()
class SubclassB(val date: Date): MySealedClass()
}
fun makeInstance(sealedClass: KClass<MySealedClass>): MySealedClass
= when (sealedClass) {
SubclassA::class -> SubclassA()
SubclassB::class -> SubclassB(Date())
}
Error: Kotlin: 'when' expression must be exhaustive, add necessary 'else' branch
kevinmost
03/03/2017, 6:59 PMif
and else
vs ?
and :
make it "unreadable", it's probably the code itself that needs to be fixedbenleggiero
03/07/2017, 2:14 AMfun java.awt.Color.Companion.fromHex(hexString: String): Color {
...
}
...
val c = Color.fromHex("#123456")
dmitry.petrov
03/07/2017, 10:04 AMdmitry.petrov
03/09/2017, 2:51 PMwhen (val str = ...) {
"foo" -> foo()
if str.contains("bar") -> bar()
if "baz" in str -> baz()
}
benleggiero
03/09/2017, 3:28 PMdamian
03/09/2017, 8:45 PMdamian
03/09/2017, 8:53 PMbenleggiero
03/10/2017, 9:02 PM#if(JS)
miha-x64
03/14/2017, 9:16 AMkotlin.Enum.Companion
contain a mapping to java.lang.Enum.valueOf()
?
Also, what about adding fun <T : Enum<T>> valuesOf(klass: KClass<T>): Array<T> = klass.java.enumConstants
?kingsley
03/14/2017, 9:46 AMfun <reified T : Enum<T>> enumValues(): Array<T>
and
fun <reified T : Enum<T>> enumValueOf(name: String): T
louiscad
03/16/2017, 2:33 PMlouiscad
03/16/2017, 2:33 PMbenleggiero
03/16/2017, 2:50 PMfun BluetoothAdapter.isOffOrTurningOff(): Boolean = when (state) {
BluetoothAdapter.STATE_OFF, BluetoothAdapter.STATE_TURNING_OFF -> true
else -> false
}
louiscad
03/16/2017, 2:53 PM