[swift-evolution] [proposal] Allow "let" for computed properties which only reference immutable data

Leonardo Pessoa me at lmpessoa.com
Tue May 17 14:40:40 CDT 2016


If the value of the property is a constant, shouldn't you just declare it
as one? If you have any sort of computation in it, even concatenating two
constant strings, can you really say this is a constant? And you would also
be overloading the compiler into trying to check for every property you use
let if the overall computation is constant or not. IMO, let isn't really
the most appropriate keyword to use for properties.

- Leonardo

On 13 May 2016 at 04:44, Andru Felipe Zuniga via swift-evolution <
swift-evolution at swift.org> wrote:

> It would be useful for clarification of a computed property being constant
> in extensions. For example:
>
> extension SKSpriteNode {
>         static let type: String {
>                 return “Sprite”
>         }
> }
>
> Andru
>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160517/b270d400/attachment.html>


More information about the swift-evolution mailing list