<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="">I’d give my +1 to support this as I’ve wished at one time or another that I could throw in the get, set, willSet, or didSet.<div class=""><br class=""></div><div class="">Would this be something a proposal should be written up for when the Swift 5 reviews begin?</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jul 25, 2017, at 2:55 PM, Xiaodi Wu via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class="">There have been a number of discussions on the list in this—Google finds a number of these with a search “swift throwing properties site:<a href="http://lists.swift.org/" class="">lists.swift.org</a>”.<br class=""><br class="">The “tldr” seems to be that it’s not supported because no one has written code to support it yet.<br class=""><div class="gmail_quote"><div dir="ltr" class="">On Tue, Jul 25, 2017 at 15:29 Gor Gyolchanyan via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">I’ll just cut to the chase:</div><div class="">Why is throwing from&nbsp;<font color="#941751" face="PT Mono" class="">get</font>, <font color="#941751" face="PT Mono" class="">set</font>, <font color="#941751" face="PT Mono" class="">willSet</font> and <font color="#941751" face="PT Mono" class="">didSet</font>&nbsp;disallowed?</div><div class=""><br class=""></div><div class=""><font face="PT Mono" class=""><font color="#941751" class="">var</font> login: <font color="#008f00" class="">String</font> {</font></div><div class=""><font face="PT Mono" class=""><span class="m_3189677645169474559Apple-tab-span" style="white-space:pre-wrap">        </span><font color="#941751" class="">willSet</font> <font color="#941751" class="">throws</font> {</font></div><div class=""><font face="PT Mono" class=""><span class="m_3189677645169474559Apple-tab-span" style="white-space:pre-wrap">                </span><font color="#941751" class="">guard</font> newValue.count &gt; 5 <font color="#941751" class="">else</font> {</font></div><div class=""><font face="PT Mono" class=""><span class="m_3189677645169474559Apple-tab-span" style="white-space:pre-wrap">                        </span><font color="#941751" class="">throw</font> <font color="#008f00" class="">LoginError</font>.loginTooSmall</font></div><div class=""><font face="PT Mono" class=""><span class="m_3189677645169474559Apple-tab-span" style="white-space:pre-wrap">                </span>}</font></div><div class=""><font face="PT Mono" class=""><span class="m_3189677645169474559Apple-tab-span" style="white-space:pre-wrap">        </span>}</font></div><div class=""><font face="PT Mono" class="">}</font></div><div class=""><font face="PT Mono" class=""><br class=""></font></div><div class=""><font face="PT Mono" class=""><font color="#941751" class="">try</font> login = <font color="#0433ff" class="">“JebediahKerman”</font> <font color="#797979" class="">// totally fine</font></font></div><div class=""><font face="PT Mono" class=""><font color="#941751" class="">try</font> login = <font color="#0433ff" class="">“Bob”</font> <font color="#797979" class="">// throws `LoginError.loginTooSmall`</font></font></div><div class=""><br class=""></div></div>_______________________________________________<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>
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>