Post #1758317
2026-04-20 14:46 UTC
@leeloo @Sarnau @mayo @dasdom
```
import Foundation
print("Cannot \("action") because \("reason")")
```
gets optimized when compiled with `swiftc -O` as you assumed.
BUT
```
import Foundation
let action = "action"
let reason = "reason"
print("Cannot \(action) because \(reason)")
```
is not optimized to "Cannot action because reason".
For localized strings, it *cannot* be optimized, the key format is documented, it will be “Cannot %@ because %@”.
Replies (1)
-
@leeloo@c.im 2026-04-20 14:57
@teilweise @Sarnau @mayo @dasdom So let is not really const? More like a readonly property? Either that or Apple couldn't afford to hire someone who can write an optimizing compiler.