LoginSignup
18
8

More than 5 years have passed since last update.

Swift Evolution の Commonly Proposed がすごい勉強になる

Last updated at Posted at 2016-12-20

Swift ユーザーの皆様ならすでにご存知かもしれませんが、Swift Evolution の Commonly Proposed という文書がすごい勉強になりました。

この文書に書かれていることは、頻繁にリクエストされた機能をなぜ採用しなかったのかという理由です。例えば、「Array<T> に添字でアクセスすると、T?T! ではなく T が返ってくるのイケてなくね?」という質問に対して、「それやると遅くなるし、そもそもロジックエラーだから」と理由を説明しています:

Make Array subscript access return T? or T! instead of T: The current array behavior is intentional, as it accurately reflects the fact that out-of-bounds array access is a logic error. Changing the current behavior would slow Array accesses to an unacceptable degree. This topic has come up multiple times before but is very unlikely to be accepted.

他にも、「{}構文を Python みたいなインデントの記法へ変えようぜ」という質問に対して、「それ宗教だから変えません」というバッサリとした回答が書かれています:

Replace {} brace syntax with Python-style indentation: Surely a polarizing issue, but Swift will not change to use indentation for scoping instead of curly braces.

他にも、「A または B の型を意味する A | B みたいなの」を導入しないと決めていることなど、興味深い内容が多く書かれています。このように、おもしろコンテンツがたくさん詰まっているので、ぜひ見てみてはいかがでしょうか?

18
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
8