内容简介:随着对 conditional conformance 的支持,Swift 4.2 在泛型方面取得了重大进展,像是减少样板代码的数量,使更多代码可重用等等。要了解有关 conditional conformance 的更多信息,请参阅:Swift 4.2 中的标准库包含许多新特性,比如 Hashable 协议的改进以及新的统一随机化函数(randomization functions)和协议集。
Swift 4.2 现已正式发布!Swift 4.2 基于 Swift 4 的优势,提供更快的编译时间,改进调试体验,更新标准库以及融合二进制兼容性。
泛型改进
随着对 conditional conformance 的支持,Swift 4.2 在泛型方面取得了重大进展,像是减少样板代码的数量,使更多代码可重用等等。要了解有关 conditional conformance 的更多信息,请参阅:
标准库更新
Swift 4.2 中的标准库包含许多新特性,比如 Hashable 协议的改进以及新的统一随机化函数(randomization functions)和协议集。
二进制兼容性
Swift 4.2 使语言更接近稳定的 ABI ,为未来的 Swift 版本实现二进制兼容性。访问 ABI Dashboard 可 了解有关此项工作当前进展的更多详情。
其他语言和编译器更新
Swift 4.2 包含许多对开发者体验有显着影响的改进,包括:
-
Support for batch mode compilation resulting in faster build times
-
Change in calling convention for retain/release cycle to reduce code size and improve runtime performance
-
Lazier SIL deserialization with -Onone
-
Recursive metadata support
-
More compact reflection metadata
-
Default arguments are inlined at call sites
-
Some long-standing bug fixes, including init declname, switch with multiple case labels per block, inheritance of generic initializers, and more
Swift 4.2 还实现了 Swift Evolution 上的一些提案:
-
SE-0054 Abolish ImplicitlyUnwrappedOptional type . Read even more details about the reimplementation here .
-
SE-0079 Allow using optional binding to upgrade self from a weak to strong reference
-
SE-0195 Introduce User-defined “Dynamic Member Lookup” Types
-
SE-0205 withUnsafePointer(to:_:) and withUnsafeBytes(of:_:) for immutable values
包管理器更新
Swift 4.2 为 Swift 包管理器引入了新功能:
-
支持批处理模式 . Swift targets will be now compiled using the Swift compiler’s batch mode.
-
Improved scheme generation logic.The scheme generation logic is improved and generates schemes as follows:
-
One scheme containing all regular and test targets of the root package.
-
One scheme per executable target containing the test targets whose dependencies intersect with the dependencies of the executable target.
-
Automatic Xcode project generation.The generate-xcodeproj has a new –watch option to watch the file system and automatically regenerate the Xcode project if needed. This uses the watchman tool to watch the required files.
Swift 4.2 还实现了 Swift Evolution 上关于包管理器的一些提案:
-
SE-0201 Package Manager Local Dependencies . SwiftPM now supports declaring dependency on a package using its path on disk instead of the git URL. This requires updating the package’s tools version to 4.2.
-
SE-0208 Package Manager System Library Targets . The PackageDescription API in tools version 4.2 supports a new type of target “system library target”, which moves the current system-module packages feature from package to target level.
-
SE-0209 Package Manager Swift Language Version API Update .
swiftLanguageVersions
property in PackageDescription manifest API for tools version 4.2 is changed from an array of Integers to an array of SwiftVersion enum.
迁移说明和更新细节可查阅:
下载地址:
以上所述就是小编给大家介绍的《Swift 4.2 正式发布:泛型改进,更快更兼容!》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- Swift 4.2 正式发布:泛型改进,更快更兼容!
- 让SpringBoot启动更快一点
- 该如何才能更快且有效的学习?
- 更快更稳定 慧荣SM2260主控测试
- 使用 WebGL 2.0 更快地渲染 3D
- MSON,让JSON序列化更快
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
计算机程序设计艺术
Donald E.Knuth / 黄林鹏 / 机械工业出版社 / 2010-8 / 69.00元
《计算机程序设计艺术(第4卷·第0册):组合算法与布尔函数概论(双语版)》是《计算机程序设计艺术,第4卷:组合算法》的第0册。《计算机程序设计艺术(第4卷·第0册):组合算法与布尔函数概论(双语版)》介绍了组合搜索历史和演化,涉及组合搜索技术的理论和实践应用,探究了布尔函数相关的所有重要问题,考察了如何最有效地计算一个布尔函数的值的技术。本册是《计算机程序设计艺术的》第7章,即组合搜索一长篇宏论的......一起来看看 《计算机程序设计艺术》 这本书的介绍吧!