The proposal's Alternatives Considered section only briefly mentions #
— which is surprising given the positive reception of posts about #
in the pitch thread (1, 2). The proposal groups it with other "arbitrary" symbols:
[5; Int]
is what Rust uses, but appears to have little association with "times" or "many". Similarly other arbitrary punctuation e.g.,
or/
or#
.
But it isn't really arbitrary — #
does have relevant associations. For example, in set theory, #S
denotes the size of a set S
. And as previously discussed, it would be compatible with the future value literal variant and source compatible with freestanding macros.
let fiveIntegers: [5 # Int] = .init(repeating: 99)
// type inferred to be [5 # [5 # Int]]
let fiveByFive = [5 # [5 # 99]]