[dmd-beta] D 2.059 beta 4

Steve Schveighoffer schveiguy at yahoo.com
Mon Apr 9 14:29:19 PDT 2012


Yeah, but 'this' isn't defined inside static member functions.  The error message is most certainly correct.

I'll also point out that if you really want to clarify what 'a' you are talking about, you can do:

typeof(this).a = a;


typeof(this) is special cased so it always works, even in static member functions that do not have a 'this' parameter.

-Steve




>________________________________
> From: Andrej Mitrovic <andrej.mitrovich at gmail.com>
>To: Discuss the dmd beta releases for D <dmd-beta at puremagic.com> 
>Sent: Monday, April 9, 2012 5:24 PM
>Subject: Re: [dmd-beta] D 2.059 beta 4
> 
>On 4/9/12, Walter Bright <walter at digitalmars.com> wrote:
>> I believe the error message is correct.
>
>I don't know about that. in TDPL p197 it says:
>"If you use an object instead of the class name when accessing a
>static member, that's fine, too.:
>auto c = (new Widget).someStaticMember"
>
>It would naturally follow that using 'this' for static members would
>be ok as well. Why break code now?
>_______________________________________________
>dmd-beta mailing list
>dmd-beta at puremagic.com
>http://lists.puremagic.com/mailman/listinfo/dmd-beta
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-beta/attachments/20120409/3109a467/attachment.html>


More information about the dmd-beta mailing list