[swift-evolution] Proposal: Contiguous Variables (A.K.A. Fixed Sized Array Type)
davesweeris at mac.com
davesweeris at mac.com
Fri Jan 29 13:16:45 CST 2016
Tuples currently can’t conform to protocols, can they?
- Dave Sweeris
> On Jan 29, 2016, at 11:14, Trent Nadeau via swift-evolution <swift-evolution at swift.org> wrote:
>
> Is having fixed arrays with large numbers of elements (256, 1024, etc.) going to cause issues with protocol conformance of tuples? I believe that since the type system doesn't currently have type-level integers, tuple protocol conformance is done via a hard-coded limit.
>
> On Fri, Jan 29, 2016 at 1:30 PM, Austin Zheng via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> That makes sense, thanks. I'm wondering if the N x T syntax might 'naturally fall out' of such a system for any other use cases.
>
> Daydreaming aside, I think this is a great proposal and it'll make 256-member C array tuples less awful to work with.
>
> Austin
>
> > On Jan 29, 2016, at 10:29 AM, Joe Groff <jgroff at apple.com <mailto:jgroff at apple.com>> wrote:
> >
> >
> >> On Jan 29, 2016, at 10:22 AM, Austin Zheng via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> >>
> >> I like the (Count x Type) design, but if Swift got integer generic parameters in the future is this what tuple shorthand syntax would still look like (not rhetorical, actually asking)? It would be nice to future-proof whatever design we come up with, to a reasonable extent.
> >
> > You'd still need something to define FixedArray<N> in terms of:
> >
> > struct FixedArray<T,N: Int> { var values: (N x T) }
> >
> > -Joe
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>
>
>
> --
> Trent Nadeau
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160129/60dbdca1/attachment.html>
More information about the swift-evolution
mailing list