• 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: for case and if case (Swift 2)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: for case and if case (Swift 2)


  • Subject: Re: for case and if case (Swift 2)
  • From: Quincey Morris <email@hidden>
  • Date: Fri, 12 Jun 2015 03:14:41 +0000

On Jun 11, 2015, at 19:48 , Marco S Hyman <email@hidden> wrote:
>
> switch test {

Roland “maliciously” misused capitalization of types. ‘test’ is actually an enum type, not a variable of enum type, so this switch statement isn’t valid either.

The example in the video is this:

> for case .MyEnumCase (let value) in enumValues {


One thing the video doesn’t show is what ‘enumValues’ is. Perhaps it’s something other than [MyEnum].

What’s odd about ‘for case’ (I think) is that there’s a two-level binding going on. There’s a retrieval of an element of the sequence (of some enum type), then there’s the retrieval of the associated value. Perhaps this is sufficiently complex to implement that it’s not actually done yet.

The following works:

> for case test.two in x {

so the pattern matching itself is implemented. The puzzle is how to correctly bind the associated value.


_______________________________________________

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


References: 
 >for case and if case (Swift 2) (From: Roland King <email@hidden>)
 >Re: for case and if case (Swift 2) (From: Quincey Morris <email@hidden>)
 >Re: for case and if case (Swift 2) (From: Marco S Hyman <email@hidden>)

  • Prev by Date: Re: for case and if case (Swift 2)
  • Next by Date: iOS version check
  • Previous by thread: Re: for case and if case (Swift 2)
  • Next by thread: Re: for case and if case (Swift 2)
  • Index(es):
    • Date
    • Thread