Forbid the use of method name "init"

Frank Benoit keinfarbton at googlemail.com
Sat May 10 14:00:45 PDT 2008


"init" and other class properties are kind of shadow-keywords.

class MyClass{
   void init(){
   }
}

The class is fine and can be used.
Now someone attempts to insert this class into a container....

template Templ(T){
   T t = T.init; // Compile error
}

The compiler should forbid the use of the method name "init", if the 
signature does not make any sense for an "init" property. It must be a 
static method, with a return value and no arguments.




More information about the Digitalmars-d mailing list