Trevor Jones wrote:

Jeremy,
unless I am very badly mistaken, this looks like a job for a language feature which AFAIK only exists in Pascal: nested procedures/functions.

Pascal doesn't have a monopoly on nested procedures. For example, although not directly supported in C++, you can fake nested functions using structures and the execute operator:


void DoStuff(TUpDown Dircetion, int Lower, int Upper)
{
struct {
  void operator()(int x)
  {
  // do stuff here...
  }
} ReallyDoStuff;

  if (Direction == Up)
    for (int x = Lower; x <= Upper; ++x)
      ReallyDoStuff(x);
  else
    for (int x = Uppwer; x >= Lower; --x)
      ReallyDoStuff(x);
}

--
Corey Murtagh
The Electric Monk
"Quidquid latine dictum sit, altum viditur!"
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to