Ifvwm
08/04/2019, 11:29 AMDominaezzz
08/04/2019, 11:30 AMKroppeb
08/04/2019, 12:10 PMIfvwm
08/04/2019, 2:00 PMgildor
08/04/2019, 2:04 PMwhen
for pattern matchingIfvwm
08/04/2019, 2:07 PMgildor
08/04/2019, 2:21 PMIfvwm
08/04/2019, 3:06 PMKroppeb
08/04/2019, 3:07 PMfun <T, R> Tree<T>.map(transform: (T) -> R): Tree<R> {
return when (this) {...}
}
Why not use an expression body?gildor
08/05/2019, 5:50 AMWhy not use an expression body?Because I don’t like to use expression body for long complicated declarations (like in this with multiple generics and lambda) it make it even more complicated and
return when
reads better in this case, but I don’t have any specific rules, just a matter of style, tend to make everything as readable as possibleKroppeb
08/05/2019, 1:33 PMgildor
08/05/2019, 1:43 PMgildor
08/05/2019, 1:44 PM