Recursion Idea for functions

Incognito via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 13 12:21:29 PDT 2016


I've been using recursion a lot lately and having to create 
multiple functions to deal with multiple paths can be a pain 
visually.

Instead, how bout a simpler syntax. This is just an idea, could 
be improved

void Recurse()
{
     scope(first)
     {
          `BLOCK`
     }
     scope(last)
     {
          `BLOCK`
     }

     Recurse();
}

which would be equivalent to

void Recurse2()
{
     Recurse2();
}

void Recurse()
{
     `BLOCK`
     Recurse2();
     `BLOCK`
}

doubling of functions starts to create a source mess.



More information about the Digitalmars-d mailing list