[swift-evolution] [Pitch] Make `return` optional in computed properties for a single case
Haravikk
swift-evolution at haravikk.me
Sat May 28 05:50:01 CDT 2016
I’m a +1 to this, this is something that keeps catching me out as I’m so used to omitting return in other closures, and that’s essentially all a computer property is anyway so it makes sense for the behaviour to be consistent.
> On 27 May 2016, at 18:57, Adrian Zubarev via swift-evolution <swift-evolution at swift.org> wrote:
>
> 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
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160528/4710803d/attachment.html>
More information about the swift-evolution
mailing list