> On 16 May 2017, at 21:27, Tony Allevato <[email protected]> wrote:
>
>> On Tue, May 16, 2017 at 1:25 PM David Hart <[email protected]> wrote:
>> The problem I see is that + is an operator of the Standard Library and not
>> part of the core language. I wouldn’t want + to sometimes to be a runtime
>> operation and other times a compile-time operation. No, I really think we
>> need strong language support here.
>
> Why not? Compile-time concatenation of string literals delimited by `+`
> sounds like a perfectly reasonable compiler optimization.
>
> Your argument would also state that the compiler should not do constant
> folding like turning `5 + 7` into `12`, would it not? What makes that
> situation different?
When does the compiler do constant folding?
Welcome to Apple Swift version 3.1 (swiftlang-802.0.53 clang-802.0.42).
Type :help for assistance.
1> import Foundation
2> let x: NSNumber = 12
x: __NSCFNumber = Int64(12)
3> let y: NSNumber = 5 + 7
error: repl.swift:3:21: error: cannot convert value of type 'Int' to
specified type 'NSNumber'
let y: NSNumber = 5 + 7
~~^~~
NSNumber( )
-- Ben
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution