<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span>Yeah, but 'this' isn't defined inside static member functions. The error message is most certainly correct.</span></div><div><br><span></span></div><div><span>I'll also point out that if you really want to clarify what 'a' you are talking about, you can do:</span></div><div><br><span></span></div><div><span>typeof(this).a = a;<br></span></div><div><br></div><div>typeof(this) is special cased so it always works, even in static member functions that do not have a 'this' parameter.</div><div><br><span></span></div><div><span>-Steve<br></span></div><div><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; margin-top: 5px; padding-left: 5px;"> <div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;">
<div dir="ltr"> <font size="2" face="Arial"> <hr size="1"> <b><span style="font-weight:bold;">From:</span></b> Andrej Mitrovic <andrej.mitrovich@gmail.com><br> <b><span style="font-weight: bold;">To:</span></b> Discuss the dmd beta releases for D <dmd-beta@puremagic.com> <br> <b><span style="font-weight: bold;">Sent:</span></b> Monday, April 9, 2012 5:24 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [dmd-beta] D 2.059 beta 4<br> </font> </div> <br>
On 4/9/12, Walter Bright <<a ymailto="mailto:walter@digitalmars.com" href="mailto:walter@digitalmars.com">walter@digitalmars.com</a>> wrote:<br>> I believe the error message is correct.<br><br>I don't know about that. in TDPL p197 it says:<br>"If you use an object instead of the class name when accessing a<br>static member, that's fine, too.:<br>auto c = (new Widget).someStaticMember"<br><br>It would naturally follow that using 'this' for static members would<br>be ok as well. Why break code now?<br>_______________________________________________<br>dmd-beta mailing list<br><a ymailto="mailto:dmd-beta@puremagic.com" href="mailto:dmd-beta@puremagic.com">dmd-beta@puremagic.com</a><br>http://lists.puremagic.com/mailman/listinfo/dmd-beta<br><br><br> </div> </div> </blockquote></div> </div></body></html>