> I just woke up but I think this can be solved with one do..while and using
> bitfield for example. so when you break, just check the bitfield what to
> clean up.

Indeed, but the original point was to make it easier to read.. Now, what
will make most sense to a newbie, this or the goto example this tries to
replace?

> $clean = 0;
> do {
>    $res = some_op();
>    if (!$res && $clean|=CLEAN_TYPE1) break;
>
>    $res = some_op2();
>    if (!$res && $clean|=CLEAN_TYPE1) break;
>
>
>    $res = some_op3();
>    if (!$res && $clean|=CLEAN_TYPE2) break;
>
>
> } while (0);
>
> if ($res & CLEAN_TYPE1) {
>   //do clean type 1
> }
> if ($clean & CLEAN_TYPE2) {
>    // do clean type 2
> }

My opinion would be that goto isn't needed with the do..while() statement..
But on the other hand.. Neither for(), while() or do..while() would be
needed with goto, would they? Is the example above or nested do..while()'s
easier to read and maintain than the same code using goto? And with the
rules everyone want with goto, you couldn't really mess anything up more
than you already can do with do..while.. Right? Ofcorse it could create
unreadable code, but then.. What couldn't? The logic of goto is simple.
Almost anyone can understand it without reading the manual. What is a newbie
more likely to abuse or use in a wrong way? Well, seems to me like he will
more likely mess up something he doesn't understand. Also. The main reason
for not adding goto has been that it can be abused. Let's see. It exists in
C, C++, C#, Python, Ada, Lisp, Pascal and who could list them all? Now.. How
much does people abuse goto in those languages? Not very much as far as I
can see (to be honest, I didn't think it existed in anything else than Basic
until I read this topic, but then, I'm not too experienced with
programming).. So why does everyone think it'll be more abused in PHP?

Just the comments from an average PHP user.
-- 
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com

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

Reply via email to