digitalmars.D - Idea for ported java static this?
- Frank Benoit (keinfarbton) (13/13) Feb 15 2007 I am porting Java code with a converter. Java is different from D in
- Walter Bright (3/6) Feb 15 2007 There's no way to do it now. But this should be possible with future
- Frank Benoit (keinfarbton) (1/3) Feb 15 2007 Ok, good to know.
I am porting Java code with a converter. Java is different from D in many things. One of the problems is the static initialization of classes. If i would add a "static this()" to every ported class, i would end up in terrible 'cyclic dep' trouble. So I decided to add a "public static static_this()" method to each class, and generate a single file, that contains all calls to these methods. I can edit the sequence. So it works, no problem so far. Problem with this solution is, that this means, that all existing classes are pulled in and the application size will grow. How can i make sure, all static_this from linked in modules are called, without having all modules forces to link in? Something like a weak link-in ref :) Any ideas?
Feb 15 2007
Frank Benoit (keinfarbton) wrote:How can i make sure, all static_this from linked in modules are called, without having all modules forces to link in? Something like a weak link-in ref :)There's no way to do it now. But this should be possible with future runtime reflection stuff.
Feb 15 2007
There's no way to do it now. But this should be possible with future runtime reflection stuff.Ok, good to know.
Feb 15 2007