What is the limit (if any) to the tuple cardinality in Swift?(Swift 中元组基数的限制(如果有的话)是什么?)
问题描述
每个元组基数都由它自己的 swift 类型表示(就像我知道的任何其他强类型编程语言一样),所以我们有
Each tuple cardinality is represented by its own type in swift (as in any other strongly-typed programming language I'm aware of), so we have
($T1, $T2)
($T1, $T2, $T3)
...
由于我们有几种不同的类型,每种基数一种,它们必须是有限的.
Since we have several different types, one per cardinality, they need to be finite.
在 Scala 中,我们最多有 Tuple22
,在 Haskell 中,当前限制应该是 64.
In Scala we have up to Tuple22
, in Haskell the current limit should be 64.
swift 有什么限制(如果有的话)?另外,是编译器生成的类型实现还是我找不到的显式实现?
What's the limit (if any) in swift? Also, are the types implementations generated by the compiler or is there an explicit implementation I couldn't find?
推荐答案
在当前版本的 Xcode 6 Beta 中,编译失败,元组的元组大于 1948(swift
可执行文件以代码 254 退出; 没有具体的警告或错误).
In the current version of Xcode 6 Beta, compilation fails with tuples of arity larger than 1948 (the swift
executable exits with code 254; there isn't a specific warning or error).
这篇关于Swift 中元组基数的限制(如果有的话)是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Swift 中元组基数的限制(如果有的话)是什么?


基础教程推荐
- 如何使用 YouTube API V3? 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- Android文本颜色不会改变颜色 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- 固定小数的Android Money Input 2022-01-01