> On Apr 15, 2016, at 12:22 PM, Stephen Canon <[email protected]> wrote:
> 
>> 
>> On Apr 15, 2016, at 11:14 AM, Erica Sadun <[email protected] 
>> <mailto:[email protected]>> wrote:
>> That said, I use M_PI_4 a lot because it's really handy for sample code. I'm 
>> one of the
>> outlier users whose use is not reflective of this quick check.
> 
> M_PI_2 and M_PI_4 are interesting cases; they date back to a time when 
> compilers couldn’t be trusted to constant-fold computations like M_PI / 2.  
> Since Swift quite reliably does this transformation, I would prefer to simply 
> use the more explicit .pi / 2.  How does that strike you as a user?
> 
> – Steve

I cannot really defend my use other than to say they are comfortable constants, 
ones that I read easily. 
Should Swift eliminate them I do not believe my code would suffer beyond muscle 
memory. Newer 
users don't necessarily resonate to them the same way, either.

I do think that adding both .pi and .π and using .π/4.0 would be the most 
readable expression of intent.

-- E

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to