[DGD]Fwd: Foreach and anonymous functions in DGD

Erwin Harte harte at xs4all.nl
Mon Jan 29 17:09:42 CET 2001


On Mon, Jan 29, 2001 at 04:58:32PM +0100, Felix Croes wrote:
[...]
>           also I have doubts about the addition of variable
> declarations in a statement, and non-mutable loop variables, to LPC.

I would like to have the former, actually.  I find it quite a bit more
elegant to do something like this:

  mixed *arr;

  for (int i = 0, sz = sizeof(arr); i < sz; i++) {
      ...work with arr[i]...
  }

Than this:

  int i, sz;
  mixed *arr;

  for (i = 0, sz = sizeof(arr); i < sz; i++) {
      ...work with arr[i]...
  }

On top of that the 2nd bit of code polutes the namespace with two
variables that I may not be using anywhere else in the same block
anyway.

Of course, this brings up a different (and possibly equally old)
discussion about initializing variables in declarations. ;-)

Erwin.
-- 
Erwin Harte         :    `Don't mind Erwin, he gets crabby. :)'
harte at xs4all.nl     :       -- Par Winzell <zell at skotos.net>

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



More information about the DGD mailing list