Just a few things that may cause you some bugs/errors

On Tue, 29 Jun 2010 23:33:13 +0200, BLS wrote:

> On 29/06/2010 22:12, Steven Schveighoffer wrote:
>       // Confirm these are the same instance
>      if (b1 == b2 && b2 == b3 )  {
>       writeln("Same instance\n");
>       }

I think you mean to use is here
 if( b1 is b2 && b2 is b3 )  // == compares value, not pointer/references


> // D2 singleton
> final class LoadBalancer {
>       private static LoadBalancer lb;
>       alias ArrayList!Server ServerList;
>       private ServerList sl;
>       
>       static this() {
>               synchronized lb = new LoadBalancer;
>       }

Might want the declare the class as synchronized, or make lb shared

>       
>       private this() {
>               sl = new ServerList;
>               sl.add([
>                       new Server("ServerI", "120.14.220.18"),
>                       new Server("ServerII", "121.14.220.18")
>               ]);
>       }
> 
try
sl = new ServerList([
                        new Server("ServerI", "120.14.220.18"),
                        new Server("ServerII", "121.14.220.18")
                ]);


>               this(string name, string id) {
>                       this._name = _name;
>                       this._id  = id;
>               }
>               

this._name = name; // you had _name


-B

Reply via email to