"bearophile" <bearophileh...@lycos.com> wrote in message 
news:j8eflp$q3o$1...@digitalmars.com...
> What do you think about a rewrite rule that changes code like:
>
> int[int] aa = [1:2, 3:4];
> void main() {}
>
>
> Into:
>
> int[int] aa;
> static this() {
>    aa = [1:2, 3:4];
> }
> void main() {}
>

You generally need to be very careful about adding module/static ctors, 
because they can easily lead to the dreaded circular ctor runtime error. So 
as nice as it would be to use AA initializers at the module-level, this 
carries a hidden danger which could be a royal PITA to debug (especially for 
D newbies), so I don't think it's a good thing to do.


Reply via email to