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() {}
Bye,
bearophile
"bearophile" 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
Nick Sabalausky:
> 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.
I see. Thank you for your answer.
Bye,
bearophile
Nick Sabalausky:
> 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 PIT
On Saturday, October 29, 2011 05:20:35 bearophile wrote:
> Nick Sabalausky:
> > 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-lev
On Fri, Oct 28, 2011 at 5:53 PM, bearophile wrote:
> 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() {}
Its not quite same case, but still could be