Upgrade to Pro — share decks privately, control downloads, hide ads and more …

optional chainingの話

yayoc
April 24, 2018

optional chainingの話

2018/04/24 Roppongi.js

yayoc

April 24, 2018
Tweet

More Decks by yayoc

Other Decks in Programming

Transcript

  1. Hello! I am 弥吉修英 I am software engineer at Fast

    Retailing. Twitter: @yayoc_ Github: @yayoc
  2. 解決策? 1. && operator 2. Ternary operator 3. Try catch

    どれも冗長さが否めない・・
  3. optional-chainingの proposal ◦ .? の左側を計算して、undefined もしくは nullの場合は、 undefinedを返す。そうでない場合は、素直にプロパティアク セスや関数実行を行う ◦

    冗長な繰り返し記述やテンポラリな変数格納を避ける ◦ ステータスはStage1 ◦ Swift, C#などにはある ◦ https://tc39.github.io/proposal-optional-chaining/ ◦ TSにもまだない。( 議論は3年以上前からあるが・・ https://github.com/Microsoft/TypeScript/issues/16
  4. Appendix ◦ https://github.com/paypal/api-standards/blob/master /api-style-guide.md#null ◦ https://github.com/tc39/proposal-optional-chaining ◦ https://github.com/yayoc/optional-chain ◦ https://medium.com/@n_yayoshi/optional-chain-pro

    xy-brings-optional-chaining-75fff102acbd ◦ https://developer.apple.com/library/content/docume ntation/Swift/Conceptual/Swift_Programming_Langu age/OptionalChaining.html
  5. CREDITS Special thanks to all the people who made and

    released these awesome resources for free: ◦ Presentation template by SlidesCarnival ◦ Photographs by Unsplash ◦ Backgrounds by SubtlePatterns