Idea for ported java static this?

Frank Benoit (keinfarbton) benoit at tionex.removethispart.de
Thu Feb 15 10:35:03 PST 2007


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?



More information about the Digitalmars-d mailing list