louiscad
04/21/2017, 1:04 PMlouiscad
04/21/2017, 1:31 PMpoohbar
04/21/2017, 2:00 PMspand
04/21/2017, 2:57 PMjw
04/21/2017, 6:37 PMirus
04/22/2017, 9:19 AMauto intefaces
? So you can write class. declare that it implements auto interface, and kotlin will generate interface using public members.mg6maciej
04/22/2017, 9:22 AMAll discussion in this channel should begin with a use-case or proposal instead of a question.
😉spand
04/25/2017, 9:34 AM.toByte()
you can just call .map()
To get rid of the many 0xFF
then I guess you can specify it in Longs 0xFF_FF_FF_FF_FF_FF_FF
and convert to bytes.
Im not sure additional syntex is needed.. seems a util package for bits and bytes could take care of most of itchristophsturm
04/25/2017, 11:52 AMdmitry.petrov
04/26/2017, 7:05 AMelizarov
04/26/2017, 9:01 AMRegex("haba")
instead of ~r/haba/
is only slightly more verbose, but way more readable. The only potential issue that one can see here is performance, e.g. that the function is being invoked at run-time, but there’s a much less intrusive way to solve that: https://youtrack.jetbrains.com/issue/KT-14652elizarov
04/26/2017, 12:19 PMconstexpr
functions are not macros. The key insight here is that you don’t really need macros most of the time. Macros is like hammer. You can do a lot of things with it, but most of the problems you encounter (inlining debug functions and generating compile-time constants are two good examples here) can (and should be) solved with more targeted features, because those narrower features get a nice tooling automatically without you having to write IDE plugin every time.rrader
04/26/2017, 12:29 PMPaul Woitaschek
05/02/2017, 5:56 AMkirillrakhman
05/05/2017, 9:52 AMelect
05/05/2017, 9:53 AMfun a() = Pair(0 to 1, 2 to 3)
fun b() {
val ((a, b), (c, d)) = a()
}
mg6maciej
05/05/2017, 11:45 AMpoohbar
05/05/2017, 1:26 PMrrader
05/05/2017, 2:08 PMKotlin’s design principle of making important things explicitthan please make that all function have throws in function declaration like in Java
elect
05/11/2017, 9:33 AMmiha-x64
05/11/2017, 12:49 PMobject SomeDeserializer : com.google.gson.JsonDeserializer<Something> {
override fun deserialize(json: JsonElement, _: Type?, _: JsonDeserializationContext?): Something {
return Something(json.get("whatever").asString)
}
}
ilya.gorbunov
05/13/2017, 8:29 PMif ((val localVal = nullableExpr) != null && localVal.property = "x") { do something with localVal }
?Slackbot
05/13/2017, 8:36 PMgroostav
05/14/2017, 7:52 AMdimsuz
05/18/2017, 4:50 PMedenman
05/22/2017, 7:35 PMelizarov
05/23/2017, 5:35 PMlateinit
? Can you share some code?Ruckus
05/24/2017, 2:38 PMgroostav
05/25/2017, 8:24 AMcatch (exception: AssertionError) {
<http://eventBus.post|eventBus.post>(ControlFlowInterruptedEvent())
return optimizationModel?.id ?: NullUUID
}
catch (exception: AssertionError) {
<http://eventBus.post|eventBus.post>(ControlFlowInterruptedEvent())
return optimizationModel!!.id
}
Can ask the compiler to make this illegal? Would it ever be useful to catch the same type like this?noctarius
05/28/2017, 5:44 PMnoctarius
05/28/2017, 5:44 PMbenleggiero
05/28/2017, 6:14 PMdata class Foo(bar: Bar, baz: Baz) {
fun copy (bar: Bar = this.bar.copy(), baz: Baz = this.baz.copy()) = Foo(bar, baz)
}
noctarius
05/28/2017, 6:20 PMFoo(foo: Foo) => foo.copy()
benleggiero
05/28/2017, 6:24 PMclass Foo(bar: Bar) {
private val shared = Foo(bar = Bar())
factory constructor() = if (condition) shared else Foo(Bar())
noctarius
05/28/2017, 6:26 PMbenleggiero
05/28/2017, 6:29 PMFoo.create()
to Foo()
noctarius
05/28/2017, 6:30 PMmiha-x64
05/28/2017, 9:07 PMbenleggiero
05/29/2017, 10:19 PMPaul Woitaschek
05/30/2017, 6:44 AMdata class Sample(val string : String) {
companion object{
operator fun invoke() = if(Random().nextBoolean()) Sample("bob") else Sample("alice")
}
}
fun whatever(){
val sample = Sample()
}
benleggiero
05/31/2017, 11:35 PM