[bisq-network/bisq] convert source code to kotlin (#3026)
Leo Wandersleb
notifications at github.com
Thu Aug 29 02:10:48 UTC 2019
I love Kotlin but your OP makes me cringe hard.
You suggest to replace
```
if (a) return X
else if (b) return Y
else return Z
```
with
```
return if (a) X else if (b) Y else Z
```
which is ugly as hell. Maybe you want to edit that to:
> for example in bisq-network/style#12 instead of
>
> ```
> int getSomeValue(@Nonnull Boolean isA, Float b) {
> if (isA) {
> return 1
> } else if (b != null && b > 5) {
> return 2
> } else {
> return 3
> }
> }
> ```
>
> you can just write
>
> ```
> fun getSomeValue(isA: Boolean, b: Float?) = when {
> isA -> 1
> (b ?: 0f) > 5 -> 2
> else -> 3
> }
> ```
as slamming all in one line is not helpful for readability and thus for security and also `{{}}` are very important by my estimates for the `if` statements to avoid additional expressions to slip out of a context.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/issues/3026#issuecomment-525991656
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190828/ecba2516/attachment-0001.html>
More information about the bisq-github
mailing list