Re: how to avoid "cycle detected"?

2015-07-03 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, July 02, 2015 06:56:26 Steven Schveighoffer via Digitalmars-d-learn wrote: > On 7/1/15 6:25 PM, Jonathan M Davis via Digitalmars-d-learn wrote: > > On Wednesday, July 01, 2015 08:52:38 Steven Schveighoffer via > > Digitalmars-d-learn wrote: > >> The runtime cannot introspect the code

Re: how to avoid "cycle detected"?

2015-07-02 Thread aki via Digitalmars-d-learn
On Thursday, 2 July 2015 at 17:21:03 UTC, Kapps wrote: An ugly solution, but the approach used in Phobos is to create something like a_init.d which a.d imports, provided that the static ctors don't actually rely on things from the static ctor of b. How about this idea? Allowing to define sub

Re: how to avoid "cycle detected"?

2015-07-02 Thread Kapps via Digitalmars-d-learn
On Wednesday, 1 July 2015 at 09:09:53 UTC, aki wrote: Following code causes run-time error. How can I use static this() without causing error? It's difficult to avoid this situation because actual code is more complex. file main.d: void main() { } file a.d: import b; class A { static th

Re: how to avoid "cycle detected"?

2015-07-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/1/15 6:25 PM, Jonathan M Davis via Digitalmars-d-learn wrote: On Wednesday, July 01, 2015 08:52:38 Steven Schveighoffer via Digitalmars-d-learn wrote: The runtime cannot introspect the code to detect the circular dependency, so it makes a conservative decision. I'm waiting on an introducti

Re: how to avoid "cycle detected"?

2015-07-02 Thread aki via Digitalmars-d-learn
On Wednesday, 1 July 2015 at 22:25:48 UTC, Jonathan M Davis wrote: On Wednesday, July 01, 2015 08:52:38 Steven Schveighoffer via Digitalmars-d-learn wrote: The runtime cannot introspect the code to detect the circular dependency, so it makes a conservative decision. I'm waiting on an introducti

Re: how to avoid "cycle detected"?

2015-07-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 01, 2015 08:52:38 Steven Schveighoffer via Digitalmars-d-learn wrote: > The runtime cannot introspect the code to detect the circular > dependency, so it makes a conservative decision. I'm waiting on an > introduction of RTInfo for modules [1] to allow us to mark static ctors >

Re: how to avoid "cycle detected"?

2015-07-01 Thread Steven Schveighoffer via Digitalmars-d-learn
On 7/1/15 5:09 AM, aki wrote: Following code causes run-time error. How can I use static this() without causing error? It's difficult to avoid this situation because actual code is more complex. file main.d: void main() { } file a.d: import b; class A { static this() {} }; file b.d: impor

Re: how to avoid "cycle detected"?

2015-07-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Wednesday, July 01, 2015 09:09:52 aki via Digitalmars-d-learn wrote: > Following code causes run-time error. > How can I use static this() without causing error? > It's difficult to avoid this situation because > actual code is more complex. > > file main.d: > void main() { > } > > file a.d: > i

Re: how to avoid "cycle detected"?

2015-07-01 Thread ketmar via Digitalmars-d-learn
On Wed, 01 Jul 2015 09:09:52 +, aki wrote: > Following code causes run-time error. > How can I use static this() without causing error? you currently can't, sorry. signature.asc Description: PGP signature

how to avoid "cycle detected"?

2015-07-01 Thread aki via Digitalmars-d-learn
Following code causes run-time error. How can I use static this() without causing error? It's difficult to avoid this situation because actual code is more complex. file main.d: void main() { } file a.d: import b; class A { static this() {} }; file b.d: import a; class B { stati