• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Swift Array with Struct Members (Compiler Bug?)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swift Array with Struct Members (Compiler Bug?)


  • Subject: Re: Swift Array with Struct Members (Compiler Bug?)
  • From: Daniel Blakemore <email@hidden>
  • Date: Thu, 11 Dec 2014 17:13:00 -0700

Sweet!  That does totally work.

Why did it compile if it's an incomplete type?  Shouldn't that be something
that you catch at compile time in a type-safe language?

I'm always hesitant about type inference in Swift because you have a 50-50
chance of the compiler not understanding at all and complaining about $T89
intermediate types not equating to Float.  And that's if your line isn't 81
characters long (i.e. longer than an arbitrary amount) and too confusing
for the compiler all together, in which case you should "consider breaking
up the expression".

I appreciate the quick help. =D


--
Daniel Blakemore
Pixio Software

On Thu, Dec 11, 2014 at 4:59 PM, Marco S Hyman <email@hidden> wrote:

> On Dec 11, 2014, at 3:24 PM, Daniel Blakemore <email@hidden>
> wrote:
> >
> > If I do this, however, it breaks:
> > var arr2 = [Array](count:6, repeatedValue:[Color](count:8, repeatedValue:
> > Color()))
>
> [Array] is syntactic sugar for Array<Array>.  It is not a complete type.
> It is an array of arrays of ????
>
> Let the type inference work for you.  Try it this way and see if it
> generates
> what you desire.
>
> var arr2 = Array(count:6, repeatedValue:Array(count:8,
> repeatedValue:Color()))
>
> Marc
>
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


  • Follow-Ups:
    • Re: Swift Array with Struct Members (Compiler Bug?)
      • From: Marco S Hyman <email@hidden>
References: 
 >Swift Array with Struct Members (Compiler Bug?) (From: Daniel Blakemore <email@hidden>)
 >Re: Swift Array with Struct Members (Compiler Bug?) (From: Marco S Hyman <email@hidden>)

  • Prev by Date: Re: Swift Array with Struct Members (Compiler Bug?)
  • Next by Date: Re: Swift Array with Struct Members (Compiler Bug?)
  • Previous by thread: Re: Swift Array with Struct Members (Compiler Bug?)
  • Next by thread: Re: Swift Array with Struct Members (Compiler Bug?)
  • Index(es):
    • Date
    • Thread