[DGD] How to make a more powerful function call?
Erwin Harte
harte at xs4all.nl
Fri Aug 10 19:53:04 CEST 2001
On Wed, Aug 08, 2001 at 02:11:20PM +0930, Greg Lewis wrote:
Hey, long time no read/see. ;-)
[...]
>
> This is mostly syntactic sugar. You can get pretty much the effect you
> want with a macro something like:
>
> #define FOREACH(s, a) for (int i = 0; i < sizeof(a); s = a[i++])
>
> There are obvious problems with this (e.g. nesting), but something similar
> will do the trick most times. I can't recall if you can declare the loop
> counter in the for statement in DGD, but I think not, so you'd need to
> alter this macro and declare it previously.
You think correctly, you can't do that in DGD (a pity, because I think
it's a very elegant use of scope).
Erwin.
--
Erwin Harte <harte at xs4all.nl>
_________________________________________________________________
List config page: http://list.imaginary.com/mailman/listinfo/dgd
More information about the DGD
mailing list