[swift-evolution] Proposal: Contiguous Variables (A.K.A. Fixed Sized Array Type)

Félix Cloutier felixcca at yahoo.ca
Thu Jan 28 16:59:41 CST 2016


I think that a (4 * Int) syntax or equivalent for uniform tuples and making them subscriptable would be very helpful when dealing with C APIs that export structures with arrays in them.

Félix

> Le 28 janv. 2016 à 17:46:40, Joe Groff via swift-evolution <swift-evolution at swift.org> a écrit :
> 
> 
>> On Jan 28, 2016, at 2:40 PM, Jacob Bandes-Storch <jtbandes at gmail.com <mailto:jtbandes at gmail.com>> wrote:
>> 
>> What is a "type-level integer expression"? The only thing I can think of is allowing numeric parameters to generics, like "Tuple<4, Int>", but I don't think that's what you're talking about.
> 
> That's what I mean, yeah. If we allow integers as type parameters, you'd conceivably want to use integer literals and expressions in this position too.
> 
> -Joe
> 
>> 
>> Jacob
>> 
>> On Thu, Jan 28, 2016 at 2:38 PM, Joe Groff <jgroff at apple.com <mailto:jgroff at apple.com>> wrote:
>> 
>> > On Jan 28, 2016, at 2:37 PM, Joe Groff <jgroff at apple.com <mailto:jgroff at apple.com>> wrote:
>> >
>> >
>> >> On Jan 28, 2016, at 2:36 PM, Jacob Bandes-Storch <jtbandes at gmail.com <mailto:jtbandes at gmail.com>> wrote:
>> >>
>> >> I like this idea, but the syntax seems dangerously close to a call site for  "func *(lhs: Int, rhs: Any.Type)"  (which is obviously ill-advised, but it is allowed).
>> >>
>> >> Maybe we could take advantage of something which would be very invalid under the current grammar, namely (n T) rather than (n * T):
>> >>
>> >>    let values: (4 Int) = (1, 2, 3, 4)
>> 
>> Bare juxtaposition might be problematic if we ever do introduce type-level integer expressions, though.
>> 
>> -Joe
>> 
> 
> _______________________________________________
> 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/20160128/ba74b6e1/attachment.html>


More information about the swift-evolution mailing list