<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jul 5, 2017 at 6:52 PM, Zhao Xin <span dir="ltr">&lt;<a href="mailto:owenzx@gmail.com" target="_blank">owenzx@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:georgia,serif">For your specific question, `func signum() -&gt; Self` returns `Self`, which can&#39;t be used in property. <br></div><div style="font-family:georgia,serif">`var signum:Self { return self }` will generate an error &quot;&#39;Self&#39; is only available in a protocol or as the result of a method in a class&quot;. So computed property can&#39;t be used here.</div></div></blockquote><div><br></div><div>This is not true, for example the following works:</div><div><div>extension BinaryInteger {</div><div>    var signumAsComputedProperty: Self {</div><div>        if self &lt; 0 { return -1 }</div><div>        else if self &gt; 0 { return 1 }</div><div>        else { return 0 }</div><div>    }</div><div>}</div></div><div><br></div><div>BinaryInteger is a prosocol. But the following will also work:</div><div><div>struct S {</div><div>    var computedPropertyReturningSelf: S { return self }</div><div>}</div></div><div><br></div><div>So I&#39;m not sure what you mean.</div><div>/Jens</div></div></div></div>