mk
01/25/2017, 5:17 PMmk
01/25/2017, 5:18 PMOption
type can still add value, even in Kotlin with null safety baked in 🙂 But I understand not everyone shares that opinionmk
01/25/2017, 5:19 PMkevinmost
01/25/2017, 5:21 PMT
is a subtype of T?
lends itself to a lot of elegance in Kotlin in my opinion. This is clearly a situation where it would have been nice to declare this function on Option<T>
h0tk3y
01/25/2017, 7:47 PMERROR
level. This, however, doesn't exclude an extension from resolution.h0tk3y
01/25/2017, 7:47 PMh0tk3y
01/25/2017, 7:48 PMkevinmost
01/25/2017, 9:15 PMkevinmost
01/25/2017, 9:15 PMaimozg
01/26/2017, 7:29 AMaimozg
01/26/2017, 7:30 AMmk
01/26/2017, 10:57 AMdmitry.petrov
01/26/2017, 11:07 AMnullIfNot
is in fact kotlin.takeIf
user
01/26/2017, 1:37 PMGetterOf
?user
01/26/2017, 1:44 PMclass UserCan(internal val me: User) {
val user = GetterOf<Long?, UserHelper> { UserHelper(it) }
val anyUser = UserHelper(null)
fun view(s: Subscription): Boolean {
if (s.user_id != null && s.user_id == me.user_id) return true
if (user[s.user_id].viewLog) return true
/*... */ return false
}
}
user
01/26/2017, 1:46 PMobj.prop(index) //=value
with obj.prop[index] //=value
user
01/26/2017, 2:51 PMuser
01/26/2017, 2:59 PMclass GetterOf<in K, out V>(val func: (K) -> V) {
operator fun get(key:K) = func(key)
}
user
01/26/2017, 3:00 PMuser
01/26/2017, 3:05 PMval x = obj.propertyValue(PropertyTypes.ENUM_1)
val y = obj.properties[PropertyTypes.ENUM_1]
user
01/26/2017, 3:05 PMuser
01/26/2017, 3:12 PMuser
01/26/2017, 3:23 PMpropertyValue
to properties
the semantics are clearer this way.cedric
01/28/2017, 6:18 PM””.split(” “) == arrayOf(””)
? I would expect an empty arrayvoddan
01/28/2017, 7:19 PMsplit
was modeled after Python's split
(because the Java's one is creasy)voddan
01/28/2017, 7:20 PMvoddan
01/28/2017, 7:20 PMcedric
01/28/2017, 7:20 PMvoddan
01/28/2017, 7:21 PMcedric
01/28/2017, 7:23 PM