V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
duesicilie
V2EX  ›  Swift

Swift 4.1 正式发布 新增更多泛型特性支持

  •  
  •   duesicilie · 2018-03-30 13:52:55 +08:00 · 4072 次点击
    这是一个创建于 2190 天前的主题,其中的信息可能已经有所发展或是发生改变。
    2 条回复    2018-03-30 13:53:50 +08:00
    duesicilie
        1
    duesicilie  
    OP
       2018-03-30 13:53:32 +08:00
    Swift 4.1 兼容 4.0,并做了一些改进,其中大部分通过了 Swift Evolution 流程。此次发布,包含了对核心语言的更新,包括新增更多对泛型的支持、新的构建选项,以及对 Swift Package Manager 和 Foundation 框架的小改进。同时在 ABI 稳定( Application Binary Interface,应用程序二进制接口)方面也取得了重大进展,期待它真的能在 Swift 5 完全实现。

    语言更新:

    Swift 4.1 增加了更多的泛型特性,进一步推进 Swift Generics Manifesto 中提出的目标:

    SE-0143 Conditional Conformance

    SE-0157 Support recursive constraints on associated types

    SE-0185 Synthesizing Equatable and Hashable conformance

    SE-0187 Introduce Sequence.compactMap(_:)

    SE-0188 Make Standard Library Index Types Hashable

    SE-0191 Eliminate IndexDistance from Collection

    Foundation 更新:

    JSONEncoder 和 JSONDecoder 类现在支持在编码和解码期间转换密钥的新策略。

    ABI 稳定:

    在本地对象头部使用 word-size 字段进行引用计数 (SR-4353)

    通过 witness table 查看与枚举鉴别器的交互效率 (SR-4332)

    判断 existential 类型元数据的布局,包括协议描述符(SR-4341)

    定义通用和协议要求的规范化以实现与顺序无关的修改(SR-3733)

    审核每个运行时功能的可取性和行为(SR-3735)

    对 Sequences 和 Collections 施加适当的约束(SR-3453)

    使用条件一致性折叠各种集合 wrapper (SR-3458)

    其它更新:

    SE-0184 Unsafe[Mutable][Raw][Buffer]Pointer: add missing methods, adjust existing labels for clarity, and remove deallocation size

    SE-0186 Remove ownership keyword support in protocols

    SE-0189 Restrict Cross-module Struct Initializers

    SE-0198 Playground QuickLook API Revamp

    具体内容请查看发布公告。
    duesicilie
        2
    duesicilie  
    OP
       2018-03-30 13:53:50 +08:00
    Swift 4.1 兼容 4.0

    我差点笑出声
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1126 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 18:47 · PVG 02:47 · LAX 11:47 · JFK 14:47
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.