<html>
<body>
<div id="Headers"><div style="padding: 10px 0pt; background-color: rgb(37, 37, 37); color: rgb(255, 255, 255); font-size: 36px; font-family: Verdana,Arial,Helvetica,sans-serif,'Trebuchet MS','Times New Roman';"><img src="cid:logo.jpg@85027972.83801" title="Logo"></div></div><div id="Body_content"><div style="padding: 5px; font-family: Arial,Helvetica,sans-serif; font-size: 12px;">
Hi,<br />
<br />
Does anyone know how to detect if there is a setter for a property? The  <br />
code below prints the same thing for both<br />
the setter and the getter of "front":<br />
<br />
==============================<br />
import std.traits;<br />
<br />
class Foo {<br />
     uint num;<br />
<br />
     @property ref uint front() {<br />
         return num;<br />
     }<br />
     @property void front(uint i) {<br />
         num = i;<br />
     }<br />
<br />
     ref uint front2() {<br />
             return num;<br />
     }<br />
}<br />
<br />
template isProperty(alias func) if (isCallable!(func)) {<br />
        enum isProperty = (functionAttributes!(func) &  <br />
FunctionAttribute.PROPERTY)==0 ? false : true;<br />
}<br />
<br />
template hasSetter(alias func) if (isCallable!(func)) {<br />
        enum hasSetter = (isProperty!(func) && ParameterTypeTuple!(func).length >  <br />
0 && ReturnType!(func).stringof != "void") ? true : false;<br />
}<br />
<br />
void main() {<br />
     Foo foo;<br />
        pragma(msg, hasSetter!(foo.front));<br />
        <br />
        static if (isProperty!(foo.front)) {<br />
                pragma(msg, "property");<br />
        } else {<br />
                pragma(msg, "not a property");<br />
        }<br />
        <br />
        alias MemberFunctionsTuple!(Foo,"front") fronts;<br />
        foreach (s; fronts) {<br />
                pragma(msg, ReturnType!(s)); // this line just prints "uint" for both  <br />
"front" properties!<br />
        }<br />
}<br />
============================<br />
<br />
<br />
Is this a compiler bug? Or am I wrong again?<br />
<br />
Thanks<br />
Rory<br />
</div></div><div id="Signatures"><div style="padding: 3px; background-color: rgb(238, 235, 230); color: rgb(86, 80, 68); line-height: 15px; font-size: 10px; font-family: Verdana,Arial,Helvetica,sans-serif;">
<strong>Rory McGuire</strong><br>
R&D<br><br>
Tel : +27 (033) 386 7263<br>
<br />
Cell : +27 (082) 856 3646<br />
<strong>Email</strong>: <a href="mailto:rmcguire@neonova.co.za" style="font-size: 10px; font-family: Verdana,Arial,Helvetica,sans-serif; color: rgb(86, 80, 68);">rmcguire@neonova.co.za</a><br>
<strong>Website</strong>: <a href="http://cf.neonova.co.za/9YXp" style="font-size: 10px; font-family: Verdana,Arial,Helvetica,sans-serif; color: rgb(86, 80, 68);">www.neonova.co.za</a><br>
<strong>VCard</strong>: <a href="https://mail1.clearformat.com/vcard.php?uid=11&pid=10" style="font-size: 10px; font-family: Verdana,Arial,Helvetica,sans-serif; color: rgb(86, 80, 68);">View</a><br>
</div></div><div class="inline_ad"><a href="http://fwd.clearformat.com/9YXn" target="_blank"><img src="cid:ff2d54b.jpg@1163517217.14931" alt="Beta Test Advert" border="0" class="inline_img"/></a></div>
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; color:#999999; padding-top:10px;">
  <div align="justify">This email and its attachments may be confidential and are intended solely for the use of the individual to whom it is addressed. Any views or opinions expressed are solely those of the author and do not necessarily represent those of NeoNova. If you are not the intended recipient of this email and its attachments, you must take no action based upon them, nor must you copy or show them to anyone. Please contact the sender if you believe you have received this email in error.</div>
</div>
</body>
</html>