Fixing cyclic import static construction problems

Jonathan M Davis jmdavisProg at gmx.com
Thu Nov 29 17:27:42 PST 2012


On Thursday, November 29, 2012 20:07:57 Andrei Alexandrescu wrote:
> I think we either do it right or leave it as it is. It's not like
> there's no workaround so if we take a stand here we better have
> something compelling.

I think that an attribute per static constructor indicating that it had no 
circular dependencies would solve the problem just fine (putting it on the 
module is problematic, because new static constructors which _do_ have actual 
circular dependencies could be added), but we certainly want to be sure of 
this before doing it.

And if we want to focus on shared or whatever now because it's higher 
priority, that's fine, but we do need to move forward with outstanding issues 
like these, and I do think that really need to solve this particular problem 
rather than considering the workarounds to be okay. A situation where static 
constructors effectively must be shunned because of the problems that they 
cause is definitely problematic considering how many features require them 
(e.g. a const or immutable static variable). And that's what we have right 
now.

- Jonathan M Davis


More information about the Digitalmars-d mailing list