[swift-evolution] /*Let it be*/ func() -> @discardable Bool {} /*Rather Than*/ @discardableResult func() -> Bool {}
Mike Kluev
mike.kluev at gmail.com
Sun Oct 15 07:55:18 CDT 2017
On 15 October 2017 at 13:35, Geordie Jay <geojay at gmail.com> wrote:
> Also we're not talking about whether the Bool itself is discardable. For
> example, it makes no sense to write:
>
> *let something: discardable Bool = true*
>
you can't write this either:
let something: inout Bool = true
that doesn't mean "inout" should be "@inputOutput" before the parameter
name in function signature.
my litmus test is: "if we did it now in swift 0.0 what would we do".
discardable before type passes this test, @discardableResult before
function doesn't.
> There has been some discussion of "throws" as a keyword. If anything I
> think that is something that is in more need of change. I've always read it
> (frustratingly) as e.g. "func throws Bool", which it doesn't, it throws an
> Error.
>
indeed. that's why "throws Bool" is wrong and if anything, i am advocating
for:
throwing func foo() -> Bool
Mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171015/7472196a/attachment.html>
More information about the swift-evolution
mailing list