----- Original Message ----- 
From: "Andi Gutmans" <[EMAIL PROTECTED]>
To: "Edin Kadribasic" <[EMAIL PROTECTED]>; "Zeev Suraski" <[EMAIL PROTECTED]>
Cc: "Jeff Moore" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Friday, July 30, 2004 4:13 PM
Subject: Re: [PHP-DEV] GOTO operator


> At 09:53 PM 7/30/2004 +0200, Edin Kadribasic wrote:
> function pseudocode()
> {
>      $a=allocate_resource_z();
>      $b=allocate_resource_y();
>
> do {
>      $res=do_stuff();
>      if(!$res)
>          break;
>
>      $c=allocate_resource_x();
>      $res=do_more_stuff();
>      if(!$res)
>          break;
>
>      $d=allocate_resource_foo();
>      $res=do_even_more_stuff();
>      if(!$res)
>          break;
>
>      return true;
> } while (0);
>
>      free_resouce($a);
>      free_resouce($b);
>      if(isset($c)) free_resouce($c);
>      if(isset($d)) free_resouce($c);
>
>      return false;
> }


edin didn't copy that from my mail, but do_stuff() was meant to be a
placeholder for an arbitrary amount of code, even inline. what happens if
do_stuff() is a while loop, or if do_more_stuff() is actually 20 lines of
relatively strongly nested code? this do-while kludge gets very hairy very
fast. i'm somewhat confuzzled why you, of all people, are advocating such
mutilation of do-while(), which is *abuse* of the construct. mutilating one
construct to emulate another construct, which won't be implemented because
it could be abused and mutilated, just doesn't compute for me.

i am onboard with the no-goto-out-of-local-scope argument, which the
do-while() kludge imposes as well. no reason this limitation can not be
implemented, if it isn't already (it is afair), in the patch.

paul

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

Reply via email to