Comments (7)
Javaのライブラリーの呼び出しするときとかで使いたいときあるかなと思ってたんですが、
そもそもプラットフォーム型という特別な扱いをするから違いましたね。
あとはKotlin製のライブラリーや何かしらのフレームワークの都合でnullable typeだけど自分の使い方ではnon-null typeでいいみたいな時に使いたいかもしれないですが、
頻発するケースがないのであればそんなに考慮しなくて良い気がしてます。
なんで方針として"基本使うな"という案で良いと思います。
from kotlin_intro.
ちなみに、「強制アンラップ」「オプショナル」というワードは Kotlin の公式リファレンスには出てこない。Swift では聞くような気がするので Swift の用語なのかもしれない。
!!
オペレータや ?
を使うことで Kotlin でも同じ意味の処理をやっているのかもしれないが、公式な用語でないということで、基本的にはこれらの単語は使わずに解説を行うように考えているところ。
from kotlin_intro.
!!
に関する公式リファレンスはおそらく以下のページ。
有効な使いどころについては触れられてない。「ぬるぽが好きなら使え」とのこと。
https://kotlinlang.org/docs/reference/null-safety.html
from kotlin_intro.
!!
の呼び方は、"non-null assertion operator" で良さそう。
ぐぐるならこれで。
from kotlin_intro.
https://medium.com/@igorwojda/kotlin-combating-non-null-assertions-5282d7b97205
Each time you use non-null assertion you are saying to Kotlin compiler “I am 100% sure that this will not be null” and the reality is that in most of cases there are better and safer ways solutions to achieve the same result.
100%ヌルじゃないことが分かってるときに使えばいいけど、そういうときはたいていもっといい書き方できるよね!
from kotlin_intro.
基本的に使わないということを書いておこうと思います。
from kotlin_intro.
@ttokutake
コメントありがとうございます。
プラットフォーム型については話せば長くなるので今回の資料には乗せていないですが、やっていくうちに考慮しないといけないケースは出てくるはずなので、まったく言及しないのも微妙ですね…。どっかで盛り込むかどうかは別途検討します。
基本方針についての確認ありがとうございます。
その線で行きます!
from kotlin_intro.
Related Issues (20)
- [関数] 再帰呼び出しの説明は必要か? HOT 1
- Exercise の追加 HOT 1
- [開発環境の構築] Android Studio を使う想定に変更する HOT 3
- when の引数なし版の解説がない
- 「kotlin に switch 文はない」は書いておこう HOT 1
- powerGen が一回多い
- Exercise の解答例
- interface についての間違い HOT 1
- はじめに リンク切れ
- gitbook installが失敗する HOT 3
- Embedding Kotlin Playgroundに対応する HOT 2
- Kotlin versionを更新する
- KotlinTrainingの廃止
- すべてのページでKotlin Playgroundが動くか検証する HOT 2
- 環境構築Minimumの手順が古いGitbookのまま
- 模範解答の準備 HOT 1
- Type to searchが動かない HOT 2
- GitHub Actions対応 HOT 1
- n面のサイコロの問題内容がわかりづらい HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kotlin_intro.