<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="">Oh, sweet.<div class=""><br class=""></div><div class="">Is there a changelog anywhere? I really like LLVM's release notes and how they're updated during development.</div><div class=""><br class=""></div><div class="">Félix</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">Le 17 déc. 2015 à 11:20:08, Keith Smiley <<a href="mailto:keithbsmiley@gmail.com" class="">keithbsmiley@gmail.com</a>> a écrit :</div><br class="Apple-interchange-newline"><div class="">I believe this has already been fixed here: <a href="https://github.com/apple/swift/commit/f524802e129f17de16fa6f8c3f08e5bcf75cc581" class="">https://github.com/apple/swift/commit/f524802e129f17de16fa6f8c3f08e5bcf75cc581</a><br class=""><div class="gmail_quote"><div dir="ltr" class="">On Thu, Dec 17, 2015 at 10:01 Félix Cloutier <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all,<br class="">
<br class="">
Initializers can now fail, but objects still need to be fully initialized before you can return `nil` from them. For instance:<br class="">
<br class="">
class Foo {<br class="">
let bar: Int<br class="">
init?(baz: Int) {<br class="">
guard baz < 100 else {<br class="">
return nil<br class="">
}<br class="">
self.bar = baz<br class="">
}<br class="">
}<br class="">
<br class="">
This trivial example causes the following error: "all stored properties of a class instance must be initialized before returning nil from an initializer".<br class="">
<br class="">
For integers, that's easy: you can simply set them to zero. However, sometimes, you'd want initialization to fail because the arguments you received don't allow you to properly initialize a member. In these cases, you have to make the fields Optionals (implicitly unwrapped or not) to overcome this.<br class="">
<br class="">
I remember that Chris said that this is a temporary issue and that it would eventually be fixed. I'm starting this thread because I'd love to have this with or before Swift 3 and I'd like to see who thinks this is big enough of an issue to rival the proposals we already have.<br class="">
<br class="">
Félix<br class="">
<br class="">
_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div>
</div></blockquote></div><br class=""></div></body></html>