[swift-evolution] @noescape and nil

Alex Hoppen alex at ateamer.de
Tue Apr 26 11:20:49 CDT 2016


I think this is a bug similar to this one: https://bugs.swift.org/browse/SR-317 <https://bugs.swift.org/browse/SR-317>. Would you mind filing a bug report for it on bugs.swift.org <http://bugs.swift.org/>?

– Another Alex

> On 26 Apr 2016, at 09:15, Aleksandar Petrovic via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Hi Swift community, I have a question.
> 
> This is a valid Swift code:
> 
> func testFunc(times: Int, fn: ((Int)->Void)? = nil) {
> 	guard let f = fn else { return }
> 	for i in 1 ..< times {
> 		f(i)
> 	}
> }
> 
> And this is not:
> 
> func testFunc(times: Int, @noescape fn: ((Int)->Void)? = nil) {
> 	guard let f = fn else { return }
> 	for i in 1 ..< times {
> 		f(i)
> 	}
> }
> 
> I can't think of any hard reason why the @noescape parameter of the function can't be nullable (and, with default value, be optional), but maybe I'm missing something. Is there any plan to correct this in 3.0?
> 
> Alex
> _______________________________________________
> 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/20160426/4990bedb/attachment.html>


More information about the swift-evolution mailing list