On Tue, Jun 28, 2016 at 3:37 PM, Aaron Bohannon via swift-users
<swift-users@swift.org> wrote:
> Does the code below have a well-defined behavior?

It invokes the eager map() that is available on Array.lazy.
Array.lazy is a collection, so it has an eager map() from the
Collection protocol.  The lazy map() does not accept a throwing
closure, so it does not match and the type checker chooses the eager
one.

Arguably, in non-generic context this code should not type check.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <griboz...@gmail.com>*/
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to