[swift-evolution] Warning on the '(T...) -> U' to '(T...) -> ()' conversion

Javier Soto javier.api at gmail.com
Tue Mar 8 15:08:32 CST 2016


Hi!

I'd like to resurface this thread. Is this something that deserves a
fully-fledged proposal? Should we add this to the @warn_unused_result
by-default proposal? https://github.com/apple/swift-evolution/pull/191/files

Thanks!

On Mon, Feb 8, 2016 at 8:44 PM Erica Sadun via swift-evolution <
swift-evolution at swift.org> wrote:

> I sincerely apologize for the lack of professionalism in my response. I
> will try to maintain higher standards in future communication.
>
> Best regards. -- E
>
> On Feb 8, 2016, at 9:41 PM, Vanderlei Martinelli <vmartinelli at alecrim.com>
> wrote:
>
> @EricaSadun I’d like to say that many of us are not native English
> speakers. I had to find what is the meaning of “gimme” and “dunno”. And it
> is a good thing, so I can learn more English words and slangs. But at the
> same time sometimes I read these messages in a place where it is not
> possible to consult dictionaries or when I just do not have time to do this.
>
> OK... Let’s explain the words:
>
> gimme. noun. a thing that is very easy to perform or obtain, especially in
> a game or sport: the kick would hardly be a gimme in that wind
>
> dunno. contraction. (I) do not know. origin mid 19th cent.: representing an
> informal pronunciation.
>
> ;-)
>
> Dunno, but the more we use internationally known words may be a gimme to
> track the subject that is Swift evolution.
>
>
> On Tue, Feb 9, 2016 at 1:47 AM, Erica Sadun via swift-evolution <
> swift-evolution at swift.org> wrote:
>
>>
>> > On Feb 8, 2016, at 8:32 PM, Joe Groff via swift-evolution <
>> swift-evolution at swift.org> wrote:
>> >
>> >
>> >> On Feb 8, 2016, at 7:25 PM, Joe Groff via swift-evolution <
>> swift-evolution at swift.org> wrote:
>> >>
>> >> Javier Soto brought up a case where his ReactiveCocoa code silently
>> did the wrong thing by implicitly discarding the result of a closure:
>> >>
>> >> https://twitter.com/Javi/status/695680700033306624
>> >>
>> >> Since it sounds like we plan on making `@warn_unused_result` the
>> default, it seems natural to also warn when a closure has its result type
>> converted away to Void. If there's one 'return' statement, we could dive
>> into the return expression to decide whether to warn based on the function
>> whose result is getting ignored.
>> >
>> > There's another axis of intent in whether the closure was written with
>> an explicit return or not. `{ foo($0) }` is ambivalent to whether it
>> intends to propagate the value returned by `foo` or not, whereas `{ return
>> foo($0) }` is explicitly trying to do so. IMO we have a stronger case to
>> warn if the `return` is explicit in the closure body.
>>
>>
>> if foo  is -> Void, it's a gimme.
>> if foo is -> T with @warn_unused_result, it's a gimme
>> if foo is -> T without @warn_unused_result, dunno
>>
>> -- E
>>
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>>
>
>
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
>
-- 
Javier Soto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160308/e5ea2188/attachment.html>


More information about the swift-evolution mailing list