[swift-evolution] For-loop revisited

Dave Abrahams dabrahams at apple.com
Fri Feb 26 10:11:38 CST 2016


> On Feb 26, 2016, at 12:42 AM, Pyry Jahkola <pyry.jahkola at iki.fi> wrote:
> 
> On 26 Feb 2016, at 04:26, Dave Abrahams via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> on Thu Feb 25 2016, ted van gaalen <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>>> (btw: If I don't put () around -60 , then the compiler complains with
>>> "Unary operator '-' cannot be applied to an operand of type 'StrideTo<Double>' "
>>> Could this be a compiler error? Shouldn't it first instantiate or evaluate the 
>>> numerical object,before glueing the .stride()  to it? ) 
>> 
>> Please file a bug report!
> 
> 
> Doesn't seem like a bug to me. In general, we want to allow an expression like -rect.width to return the negative width, and not apply the unary operator to rect first. Same goes to -array.reduce(0, combine: +), for example.
> 
> Hence, member access and function application bind tighter than prefix operators.

You're right, thanks.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160226/a62fe57b/attachment.html>


More information about the swift-evolution mailing list