static this

Chris Miller chris at dprogramming.com
Fri Oct 6 03:40:46 PDT 2006


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.

>
> 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()  :)



More information about the Digitalmars-d mailing list