[DGD]Re: Foreach and anonymous functions in DGD

Lee Randolph Salzman lsalzman+ at andrew.cmu.edu
Wed Jan 31 10:02:57 CET 2001


I polished up the implementation some more, added some documentation, fixed some
bugs, and added a feature here and there. Hopefully, this should more or less be
a feature freeze on my modifications.

Within anonymous functions, one can now refer to free variables (and they will be
automatically curried for you, hence they are now real closures - the one exception
being that global variables are not curried and so may be muted).
example:
function make_adder (int x)
{
    return \int (int y) { return x + y; };
}

which is equivalent to:
function make_adder (int x)
{
    return curry (\int (int x, int y) { return x + y; }, x);
}

Also, foreach () should respect much stronger type check rules, especially for arrays
(trying to match iterator type with array type if possible).

So, would it be possible to have these changes merged into DGD (pending testing 
and such)? I am attempting to work on a mud with DGD (as opposed to MudOS) and I
hesitate to so without these features, which is why I added them in the first place. :)

					Lee Salzman
					P.S. Patches/tarballs available at same exact place.

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



More information about the DGD mailing list