> On Aug 2, 2017, at 12:17 PM, Félix Cloutier <[email protected]> wrote: > `[Int x N]` solves all of the problems that I mentioned, and I'm happy with > that syntax. In fact, I'm championing its merits versus an approach that > doesn't include the number of elements. :) > > Unless I got things wrong this entire time, the proposed spelling > <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20170731/038341.html> > was `fixed [Int]`, with no mention of the number of elements.
I agree that an array with a dynamic, value-specific but fixed bound seems basically pointless. It's more of a minor optimization hint than a real type. John. > > Félix > >> Le 2 août 2017 à 09:00, John McCall <[email protected] >> <mailto:[email protected]>> a écrit : >>> >>>> var foo = fixed [Int]() >>>> for i in 0..<param { >>>> foo.append(i) >>>> } >>> >>> Arrays can't work if elements don't have a fixed size. How big is an >>> element in this example? >> >> This is not the idea. The idea is more like >> >> let n = ... >> var foo = [Int x n](repeating: 13) >> >> The bound value is still fundamentally part of the type of the variable; >> it's just that the actual value is not known statically. >> >> John. >
_______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
