Re: Re: Bug #13616 Updated: Compiler complains about function declaration after return is called

From: Date: Wed, 17 Oct 2001 16:38:16 +0000
Subject: Re: Re: Bug #13616 Updated: Compiler complains about function declaration after return is called
References: 1 2 3  Groups: php.dev 
Request: Send a blank email to php-dev+get-68146@lists.php.net to get a copy of this message
No, exit changed as well. function foo(){ echo "foo"; } exit; function foo(){ echo "foo"; } Yields an error. This really has nothing to do with return or exit accept that in the past there was obviously some mechanism to not complain about duplicate functions when past an exit or return. Couldn't code after return or exit be treated as conditional, like code in and if statement? And for those who want to use include once, it does not do the job. If I include_once in a function, the variables that are included in that file are lost at the end of that function. That does me no good now because the file can not be included again. So, if that is possible, why can't we find a better solution to this. This sounds like a quick fix for a dumb decision a while back. All that has lead to is something that is going to break code all over the world. <soapbox> Another point I would like to make is that decisions are being made here by people who code C in making PHP and do not code PHP for a living. I do. I know how the focus can be lost as I loose it some times with Phorum. I do not use Phorum everyday like some others. I realized a while back that the code I was writing was pretty and neat but a lot of it was useless to the people who use the product. Please don't get bogged down in what you think is the way is should work and forget about all the people who have come to expect certain things of PHP. </soapbox> Brian Moon ---------------------------------------------------------------------- dealnews.com, Inc. Makers of dealnews, dealmac http://dealnews.com/ | http://dealmac.com/ ----- Original Message ----- From: <jeroen@php.net> To: <php-dev@lists.php.net> Sent: Wednesday, October 17, 2001 11:16 AM Subject: [PHP-DEV] Re: Bug #13616 Updated: Compiler complains about function declaration after return is called > > "Brian Moon" <brianm@dealnews.com> wrote in message > news:00c601c15725$d00cf0c0$70fcf818@toney1.al.home.com... > > This is a huge compatibility breaker. The sad part is that you did not > > properly fix the bug in 9884. The bug is that the compiler looks past a > > return when compiling. > > That is not the bug, all languages do that. PHP4 has always parsed the whole > script, and will probably remain doing so. > > The issue here is that a functiondefinition isn't put in the function table > until the function definition is executed. > > This allows conditional function declaration. > > Zeev's bugfix fixed bug 9884 by changing semantics of return, by making > 'return'-ing from a script simply not possible anymore. > > > Does it look past an exit? > > It looks past everything, but _return_ in the body of a script is ignored, > but exit isn't. Using exit, nothing changed. Only return changed. > > --Jeroen > > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net > > >

« previous php.dev (#68146) next »