Sylvain Patenaude
12/03/2019, 10:24 PMpackage toto.toto2
@ExperimentalUnsignedTypes
fun UByteArray.toUnsignedInt(): UInt {
return ...
}
When I try to call it from inside an object
, like this: myUInt = myUByteArray.toUnsignedInt()
, I have an Unresolved reference.
Thanks in advance!Gyuhyeon
12/04/2019, 6:45 AMclass MembershipInfo {
var birthday: String? = null
get() = if (field.isNullOrBlank() && birthdayEnc.isNotNullOrBlank()) {
field = birthdayEnc.let {
AesEncryptor.decryptText(it)
}
field
} else {
field
}
var birthdayEnc: String? = null
get() = if (field.isNullOrBlank() && birthday.isNotNullOrBlank()) {
field = birthday.let {
AesEncryptor.encryptText(it)
}
field
} else {
field
}
}
this code is giving me a wonderful stack overflow error when both fields are set as null. apparently, calling birthdayEnc.isNotNullOrBlank() calls birthdayEnc's getter instead of accessing it directly. This is calling from WITHIN the class, this seems like a design oversight ._.
any workarounds?michmanharitonov1
12/04/2019, 7:43 AMspand
12/04/2019, 8:25 AMsealed class Sc {
object Foo : Sc()
}
fun (sc: Sc){
when (sc){
Sc.Foo -> sc // <-- type is still Sc here, not Foo
}
}
Seems like a basic case but I couldnt even find an issue on youtrack about itjimn
12/04/2019, 9:27 AMJukka Siivonen
12/04/2019, 9:45 AMAshutosh Panda
12/04/2019, 10:01 AMAshutosh Panda
12/04/2019, 10:13 AMjimn
12/04/2019, 10:13 AMChris Miller
12/04/2019, 10:28 AMsealed class TimedEvent(val eventTime: Long)
data class FxRateEvent(val currency: String, val rate: Double, eventTime: Long) : TimedEvent(eventTime)
Xavier F. Gouchet
12/04/2019, 11:00 AMPacane
12/04/2019, 3:12 PMclass A<T> {}
to
class <A?> {}
in Kotlin ?Hullaballoonatic
12/04/2019, 5:11 PM{ ... } { ... }
I'm musing on the reason why you can't place multiple lambda arguments outside the function parameter parentheses:
myPairs.associateBy { (k, _) -> k } { (_, v) -> v } // does not compile
myPairs.associateBy({ (k, _) -> k }, { (_, v) -> v }) // compiles
nbd. just thinking
of course maybe it just doesn't read well, since parameters are separated by a comma, and sequential lambda arguments outside the parentheses would not.steenooo
12/04/2019, 5:47 PMAdam Spofford
12/04/2019, 10:04 PMsequence { }
with abstract suspending functions, because StreamingCmd
has to inherit from CmdBase
and so can't inherit from SequenceScope
Mani
12/05/2019, 8:40 AMmutableMap<String, String>
? .toString() works?gotoOla
12/05/2019, 10:22 AMasad.awadia
12/05/2019, 10:31 AMwasyl
12/05/2019, 11:19 AMfun doSomething(param: String)
fun foo(param: String)
foo { doSomething(it) }
vs
foo(::doSomething)
vs
foo(instance::doSomething)
is bytecode for either option more efficient for example?Ashutosh Panda
12/05/2019, 12:40 PMLeon K
12/05/2019, 4:11 PMrequire
and requireNotNull
? currently afaik it always throws an IllegalArgumentException
steenooo
12/05/2019, 4:24 PMSlackbot
12/05/2019, 8:11 PMfarmerbb
12/05/2019, 8:19 PMcodeslubber
12/05/2019, 9:32 PME.Kisaragi
12/05/2019, 11:27 PMserebit
12/05/2019, 11:57 PMJoey
12/06/2019, 1:32 AMJoffrey
12/06/2019, 10:50 AMMap<K, List<V>>
from a List<Pair<K,V>>
?
I'm looking for the same thing as toMap()
, but instead of discarding duplicate keys, it would aggregate the values in a list.
For now, I haven't found shorter than this trivial groupBy
:
fun <K, V> List<Pair<K, V>>.toMapAggregate(): Map<K, List<V>> = groupBy(
{ (k, _) -> k },
{ (_, v) -> v }
)
alexcouch
12/06/2019, 11:19 AMalexcouch
12/06/2019, 11:19 AMArtyom Degtyarev [JB]
12/06/2019, 11:26 AMalexcouch
12/06/2019, 11:42 AMilya.matveev
12/06/2019, 11:52 AMalexcouch
12/06/2019, 12:46 PM