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.
|