[Vala] class constructor not being called



I'm trying to understand why class constructors are not being called. 
According to the docs:

class-class-constructor-declaration:
        class construct { statement-list }
This block will be executed once at the first use of its class, and once
at the first use of each subclass of this class.

But in the following code, the "class construct" block is never fired"

class MyClass: Object {                                                  
                                                                                      
    class construct {                                                    
        // class constructor                                             
        stdout.printf("Hello world\n");                                  
    }                                                                    
                                                                                      
    public static void noop() {                                          
    }                                                                    
}                                                                        
                                                                                                              
        
void main() {                                                            
    MyClass.noop();                                                      
} 

Either I'm doing something wrong, or I'm not understanding.  Shouldn't
"Hello world" be printed once sometime before .noop() is called? 
Instead it's not printed at all.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]