Replies: 2 comments 1 reply
-
|
非nullアサーションのような方が良さそう Kotlin の Null-Safety を実現するための仕組みはこのページにあるので一回眺めるだけでも良さそうかも |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
ここで考えるべきことは、 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
いい感じにnull許容型の値を取り出せる演算子が欲しい
上のコードで、
xに値が設定されている(=x.HasValueがtrue)な時、x.Valueの値を返して、値がないときはnull参照エラーにするのが良さそう。ユーザー入力がらみで
null許容な値が出てくることが割とあって、頻繁に書く割には文法として楽じゃないのが良くなさげ。例えば以下のコードは割と良くある。
Beta Was this translation helpful? Give feedback.
All reactions