- Swift Functional Programming(Second Edition)
- Dr. Fatih Nayebi
- 103字
- 2021-07-02 23:54:20
Type safety and type inference
Swift has a strong emphasis on types. Classes, enums, structs, protocols, functions, and closures can become types and be used in program composition.
Swift is a type-safe language, unlike languages such as Ruby and JavaScript. As opposed to type-variant collections in Objective-C, Swift provides type-safe collections. Swift automatically deducts types by the type-inference mechanism, a mechanism that is present in languages such as C# and C++ 11. For instance, constString in the following example is inferred as String during compile time, and it is not necessary to annotate the type:
let constString = "This is a string constant"
推薦閱讀
- 數據庫基礎教程(SQL Server平臺)
- PyTorch深度學習實戰:從新手小白到數據科學家
- Mastering Ninject for Dependency Injection
- MongoDB管理與開發精要
- 卷積神經網絡的Python實現
- MySQL從入門到精通(第3版)
- Mastering Machine Learning with R(Second Edition)
- Dependency Injection with AngularJS
- Spark大數據分析實戰
- 深入淺出 Hyperscan:高性能正則表達式算法原理與設計
- R語言數據挖掘
- Python數據分析與挖掘實戰(第3版)
- 數據科學實戰指南
- 從實踐中學習sqlmap數據庫注入測試
- Microsoft Dynamics NAV 2015 Professional Reporting