<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Well, the question still remains about why the compiler chose init(exactly:) over init(). Shouldn’t there at least a warning of ambiguity?<div class=""><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Saagar Jha</div>

</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On May 1, 2017, at 12:11, Zhao Xin via swift-users &lt;<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class=""><div class="gmail_default"><font face="georgia, serif" class="">In my test, compiler thought you use `</font><span class="gmail-syntax-keyword" style="font-family: arial, sans-serif; font-size: 11px; white-space: pre-wrap;">init</span><span style="font-family: arial, sans-serif; font-size: 11px; white-space: pre-wrap;" class="">?(</span><span class="gmail-syntax-identifier" style="font-family: arial, sans-serif; font-size: 11px; white-space: pre-wrap;">exactly</span><span style="font-family: arial, sans-serif; font-size: 11px; white-space: pre-wrap;" class=""> </span><span class="gmail-syntax-param-name" style="font-family: arial, sans-serif; font-size: 11px; white-space: pre-wrap;">value</span><span style="font-family: arial, sans-serif; font-size: 11px; white-space: pre-wrap;" class="">: </span><span class="gmail-syntax-type" style="font-family: arial, sans-serif; font-size: 11px; white-space: pre-wrap;"><a style="color:rgb(0,51,102);text-decoration:none" class="">Double</a></span><span style="font-family: arial, sans-serif; font-size: 11px; white-space: pre-wrap;" class="">)`, </span><span style="white-space: pre-wrap;" class=""><font face="georgia, serif" class="">which returns nil. So this is not a bug.</font></span></div><div class="gmail_default" style="font-family:georgia,serif"><span style="font-size: 11px; white-space: pre-wrap; font-family: arial, sans-serif;" class=""><br class=""></span></div><div class="gmail_default"><span style="white-space: pre-wrap;" class=""><font face="georgia, serif" class="">Zhaoxin</font></span></div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Tue, May 2, 2017 at 1:39 AM, Halen Wooten via swift-users <span dir="ltr" class="">&lt;<a href="mailto:swift-users@swift.org" target="_blank" class="">swift-users@swift.org</a>&gt;</span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br class="">
<br class="">
I'm seeing a weird issue with using an initializer in flatMap. Here's<br class="">
an example:<br class="">
<br class="">
```<br class="">
let time: TimeInterval? = 662.82582598600004<br class="">
let intTimeFlatmap = time.flatMap(Int.init) // nil<br class="">
let intTime = Int(time!) // 662<br class="">
```<br class="">
<br class="">
I would expect for the flatMap call to return an optional Int with the<br class="">
proper value of 662. Is there something I'm misunderstanding, or is<br class="">
this a swift bug?<br class="">
<br class="">
Thanks,<br class="">
Halen<br class="">
______________________________<wbr class="">_________________<br class="">
swift-users mailing list<br class="">
<a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-users" rel="noreferrer" target="_blank" class="">https://lists.swift.org/<wbr class="">mailman/listinfo/swift-users</a><br class="">
</blockquote></div><br class=""></div>
_______________________________________________<br class="">swift-users mailing list<br class=""><a href="mailto:swift-users@swift.org" class="">swift-users@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-users<br class=""></div></blockquote></div><br class=""></div></body></html>