FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

circular initialization dependency with module Event

 
Post new topic   Reply to topic     Forum Index -> Mango
View previous topic :: View next topic  
Author Message
keinfarbton



Joined: 03 Dec 2005
Posts: 224
Location: Stuttgart - Germany

PostPosted: Sat Dec 03, 2005 12:37 pm    Post subject: circular initialization dependency with module Event Reply with quote

When I run the logging example, I get the runtime error
"Error: circular initialization dependency with module Event".

I figured out, that this error comes, Event includes Layout/Manager and vice versa. Both have static this(). So it is not clear, which has to run first.
To fix this, I post the diff:

Index: Manager.d
===================================================================
--- Manager.d (Revision 574)
+++ Manager.d (Arbeitskopie)
@@ -53,7 +53,7 @@

class Manager
{
- static public Hierarchy base;
+ static private Hierarchy _base = null;

/***********************************************************************

@@ -71,9 +71,12 @@

***********************************************************************/

- static this ()
+ static protected Hierarchy base()
{
- base = new Hierarchy ("mango");
+ if( _base is null )
+ _base = new Hierarchy ("mango");
+
+ return _base;
}

/***********************************************************************
Index: Layout.d
===================================================================
--- Layout.d (Revision 574)
+++ Layout.d (Arbeitskopie)
@@ -113,17 +113,20 @@

public class SimpleLayout : Layout
{
- static protected SimpleLayout simpleLayout;
-
+ static private SimpleLayout _simpleLayout;
+
/***********************************************************************

Make one of these available for use as the default layout

***********************************************************************/

- static this ()
+ static protected SimpleLayout simpleLayout()
{
- simpleLayout = new SimpleLayout();
+ if( _simpleLayout is null )
+ _simpleLayout = new SimpleLayout();
+
+ return _simpleLayout;
}

/***********************************************************************


While working with the svn repository, i noticed, that the format/* files are not added there.
Frank
Back to top
View user's profile Send private message
kris



Joined: 27 Mar 2004
Posts: 1494
Location: South Pacific

PostPosted: Sat Dec 03, 2005 2:12 pm    Post subject: Reply with quote

Thanks, Frank. Very much appreciate the patches! I'll apply those for the next release.

The circular init problem has been a pain for a while ~ some people run into the problem and others don't (I don't, for example). There's an outstanding bug-report on this, since the issue is dependend upon the order the modules are fed to the compiler Crying or Very sad

The format/ directory was replaced with the convert/ directory in one of the recent releases ~ there's been some consolidation and cleanup going on in Mango. Ack! I just realised the logging example was not updated ... will fix that right now.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Mango All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group