[swift-evolution] [Pitch] Make `return` optional in computed properties for a single case

Adrian Zubarev adrian.zubarev at devandartist.com
Fri May 27 12:57:16 CDT 2016


The idea is simple:

Can we make return keyword optional in cases like this?
Shouldn’t this behave like @autoclosure or @noescape?
type A {
    var characters: [Character] = …
    var string: String { String(self.characters) }
    var count: Int { 42 }
}
Is this worth a proposal or Swifty enough, what do you think?

Sure I could write return, but why do we allow this behavior for @noescape functions like map!?



-- 
Adrian Zubarev
Sent with Airmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160527/38f019a0/attachment.html>


More information about the swift-evolution mailing list