[DGD] Re: LPC repository

Claus Draeby claus at harpo.ma.adfa.oz.au
Mon Dec 15 01:36:58 CET 1997


> [...] Dworkin wrote:
> > I am currently porting some rather old ( <= 1994 ) code for the Flat
> > Earth MUD lib to DGD, and this at least contains some morsels that I
> > think would be interesting. However, I have made some alterations to
> > DGD to get it to work, most remarkly I have made (int)0 a true neutral
> > element for plus, thus ensuring that:
> > 	0 + x = x + 0 = x,
> > regardless of the type of x. I think I will supply this as a package
> > one day, but I have not talked it over with Dworkin yet. However it
> > get rid of constructs like this
> > 	mapping m;
> > 	if (m["whatever"])
> > 		m["whatever'] += ({ "another whatever" });
> > 	else
> > 		m["whatever'] = ({ "another whatever" });
> > which in my DGD can be stated simply as:
> > 	m["whatever'] += ({ "another whatever" });
> 
> What about
> 
>     string s;
> 
>     s += "foo" + 0;
> 
> or even
> 
>     int n;
> 
>     n = 0;
>     write("the value of n is " + n + ".\n");
You are absolutely right, however I find the fix:
    write("the value of n is " + (string)n + ".\n");
much nicer than the two line fix of the mapping/array problem, and from a 
language view even cleaner too.

Yet, I admit that it invalides some old code. However, we made the change to the 
old driver we used, and the string+int problem seemed to be much less common 
than the array/mapping int 0 value trouble.

Thats why I consider it a possible package, rather than a bugfix :-)
It is like double slash comments, a matter of style.

Azhrarn



List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list