HaloO,

Juerd wrote:
Both recently discussed situations with blocks can be solved by
introducing a way to leave the current block and resume it elsewhere.


With first class code types, &_ and &label beeing bound lexically
to the current instance of the sub class, the set of current control
flow procedures (next, leave, goto, ...) are sufficient.


Skipping the check after it matched the first time:

    my macro loopbody { ... }
for (...) {
        pause, next if condition;
        loopbody;
    }
    cont {
        loopbody;
    }

Why not simply:

   for (...)
   {
      if condition
      {
         # or &OUTER::_ ?
         &_ = &loopbody; # or (re)binding with := ?
         next if first_true_skips_loopbody_once;
      }

      loopbody:
      ...
   }

Only drawback is that assignment to &_ plays in the
same league of bad programming practices as goto.
OTOH, I expect the optimizer to pull exactly the above
stunt given enough type information about the condition.
And I hope we all agree, that goto behind the scenes is
not a bad thing :)
--
$TSa.greeting := "HaloO"; # mind the echo!

Reply via email to