> On Oct 4, 2016, at 11:07 AM, Adrian Zubarev <[email protected]>
> wrote:
>
> Doesn’t this imply more performance cost? Don’t get me wrong but the value
> here is not fixed and computed all over again which might waste resources if
> the calculation is complicated. Sure we could build some workarounds here and
> there, but the codebase won’t get any prettier after that.
>
I doubt it. Formally, integer and string literals are also constructor calls,
but they're inlined and constant-folded away in most cases. A struct
construction is also likely to be optimized. The code pattern I presented is
exactly what the compiler automatically generates when you use the sugar syntax.
-Joe
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution