On Monday 06 June 2005 16.35, Stanislav Malyshev wrote:
> LS>>your arguments are acedemic. in the real world the goto label
> will be LS>>relatively easily found, whereas finding the catch
> block that will in the
>
> I'm not concerning about you missing your label. I'm concerned
> about you jumping to places where you shouldn't be by the engine
> logic and by the code logic.
>
> LS>>is bad professor" must have died from a hard attack by
> suggesting that LS>>exceptions should be used to emulate goto's for
> non error cases.
>
> Nobody said exceptions should be used to emulate goto. I said goto
> has too high abuse potential to be a good language feature.

Not that I see how exceptions came into the discussion, but anyway.

I have small example of "code" that would be so much easier to 
understand and follow with goto..

I removed all actual code to make it a bit shorter, it's actually 
around 150-200 lines long, just this outer for-loop..

for (...; ...; ...) {
  if (...) {
    ... code ...
    for (...; ...; ...) {
      if (...) {
        if (...) {
          ... code ...
          continue 2;
        } else {
          ... code ...
          break;
        }
      } elseif (...) {
        ... code ...
        break;
      } else {
        if (...) {
          ... code...
        }
        ... code ..
      }
    }
    if (...) {
      ... code ...
    } else {
      ... code ...
    }
  } else {
    .... code ...
  }
}

I have two more like that one.. 
First a main one, the one above is in a function and the other one in 
another function.. They were all part of the same one when I first 
made it, but as all the breaks and continues made it impossible to 
understand how the code worked, I made the code pass around some vars 
instead and break/continue in the main one instead depending on what 
the functions return. So if I want to add more stuff I would have to 
change breaks and continues in all three anyway, but at least now I 
can understand what it does, although I have to read it several times 
first and adding some simple thing to it is just a headache.

I actually have to add and change some things in it, but if we are not 
going to have goto in PHP I'm just going to rewrite it as a small app 
in C which have goto instead and save me hours and hours of headache. 
Without exaggerating, I get depressed everytime I look at the code..

I'm sure there are others who have an equal or an even worse mess to 
work with.


Magnus Mtt

-- 
Wouldn't this be a great world if being insecure and desperate were a 
turn-on?
                -- "Broadcast News"

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to