• 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: what is the difference between properties and functions?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Swift: what is the difference between properties and functions?


  • Subject: Re: Swift: what is the difference between properties and functions?
  • From: Quincey Morris <email@hidden>
  • Date: Fri, 01 Aug 2014 22:28:54 -0700

On Aug 1, 2014, at 21:56 , Marco S Hyman <email@hidden> wrote:

The call-back will print the same temperature as A, but might print a different forecast. Correct?

Not, I think, if forca1 is defined as above.  Now if you had
used 'var' instead of 'let' then it is possible that something
other than w.forcast will be invoked.

Taking Gerriet to mean that the ‘forecast’ method could come up with different answers at different times (that is, not with the original code), then I think his conclusion is correct, even if ’temperature’ also could give different answers at different times. His example contains two invocations of ‘forecast()’, each result being used once, but only one of ‘temperature’, whose result is used twice.

But I was wrong on a technicality about ‘map’. Now that I actually check its signature, I see that the closure needs a parameter, so the parameterless method isn’t suitable for that context.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Swift: what is the difference between properties and functions? (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: Swift: what is the difference between properties and functions? (From: Marco S Hyman <email@hidden>)

  • Prev by Date: Re: Swift: what is the difference between properties and functions?
  • Next by Date: Re: Xcode burp on project load
  • Previous by thread: Re: Swift: what is the difference between properties and functions?
  • Next by thread: Xcode creates silly Bundle identifier
  • Index(es):
    • Date
    • Thread