weak self

13: 喬喬 Erasure


Listen Later

{ 完整節目筆記 https://weakself.dev/episodes/13 } 又是歡樂的一集!今天聊起 #weakself挑戰賽的 Type Erasure 與 Opaque Return Type。不過,怎麼某人的聲音到後半段就 erased 了!? 前言 上一集成為最熱門集數,所以跟新朋友打招呼、解釋一下我們的名稱 weak self 這個名稱,寫 Swift 或 iOS 工程師一看就知道。但我們其實沒有中文名稱,大家可以幫忙想 weak self, strong community 鐵人賽 iOS Developer Learning Android 系列 by @MarkFlyyyyy 30 天了解 Swift 的 Combine 最高觀看數 bug? 其他整理請見«13的開發者週報» xcode-install 我恨 PAT PAT 是什麼?看 code PAT 三不能: 不能做為變數型別用 不能做為 function 的 return 不能放在 Collection 裡 你是忘記還是害怕想起: Type Erasure 為何而生 PAT 難搞的地方有兩種: 有 Self 的 Protocol:Hashable 有 associatedtype 的 Protocol:IteratorProtocol 對應的做法: AnyHashable: 黑魔法 C++ AnyIterator: 用 generic struct 解決 範例請見這裡 對 AnyHashable 有興趣請右轉 Opaque Return Type weakself 的中文名稱是個 Opaque Type (Caller 決定 generic 是什麼) Opaque Return Type 則由 Callee 決定 generic 是什麼 避免 generiception: public typealias LazyCompactMapCollection  -> C where C.Element == ElementOfResult  = LazyMapSequence>, ElementOfResult> 也是對於 Type Erasure 的一種根本性解決手法 範例請見:https://gist.github.com/pofat/a411d785e593982868a54e140f48ad8f 那第三個問題,不能把 PAT 放入 collection 呢? 抱歉,還無法🤷‍♂️ 更多 weak self 主講人 一三波肥喬喬 官網 https://weakself.dev Twitter @weak_self 提問箱



This is a public episode. If you would like to discuss this with other subscribers or get access to bonus episodes, visit weakself.substack.com
...more
View all episodesView all episodes
Download on the App Store

weak selfBy 一三、波肥、喬喬

  • 4.9
  • 4.9
  • 4.9
  • 4.9
  • 4.9

4.9

10 ratings