static this
Max Samuha
maxter at i.com.ua
Fri Oct 6 04:30:18 PDT 2006
On Fri, 06 Oct 2006 06:40:46 -0400, "Chris Miller"
<chris at dprogramming.com> wrote:
>On Fri, 06 Oct 2006 06:01:09 -0400, Max Samuha <maxter at i.com.ua> wrote:
>
>> Two questions to the community:
>>
>> 1. The following is obviously a bug?
>>
>> class Test
>> {
>> static
>> {
>> this(){}; // defined not as static constructor but as
>> instance constructor
>>
>> ... more static members here
>> }
>> }
>
>I also asked about this before and it's not a bug, "static" and "this" are
>supposed to be together, like static assert.
>
Then the compiler should definitely disallow 'this' in a static block
giving a good compile time error message?
>>
>> 2. Why module constructor must be attributed with static? All module
>> level methods are already static so the attribute seems to be
>> redundant. Make it optional?
>
>I guess you're right; my suggestion was to rename main() to this() :)
There may be 'this' in different modules. How the entry point would be
determined then? Or please give me a link to the thread where your
suggestion was discussed.
More information about the Digitalmars-d
mailing list