Bug #9250 Updated: Nested Functions are BAD, they make for inefficient debugging
| From: | jan@php.net | Date: | Sun, 06 Jan 2002 18:15:00 +0000 |
| Subject: | Bug #9250 Updated: Nested Functions are BAD, they make for inefficient debugging | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-76075@lists.php.net to get a copy of this message | ||
ID: 9250
Updated by: jan
Reported By: dsifry@linuxcare.com
Old Status: Open
Status: Bogus
Bug Type: Feature/Change Request
Operating System: Any
PHP Version: 4.0.4pl1
New Comment:
brackets are used for other controll structures as well, so disabling
nested functions do not solve the problem. ->bogus
Previous Comments:
------------------------------------------------------------------------
[2001-02-14 04:10:46] dsifry@linuxcare.com
If you have a missing close-bracket "}" somewhere in your code, the PHP
parser tells you that the error is at the last line. If you have a
multi-hundred or thousand line file, this makes life a bitch.
Rasmus tells me that the reason for this behavior is because functions
can be nested, which means that:
function a
{
function b
{
}
}
is OK. This is a silly feature. Why do you have it, for scoping
reasons? It means that you can't effectively tell where syntax errors
occur.
Suggestion: Either make nested functions turned off by default but you
can turn them on with a PHP global variable, like
$PHP_BIZARRO_NESTED_FUNCTIONS = 1;
or
have the parser syntax set up so that it marks where a possible syntax
error occurred (IOW it sees a possible nested function, but it could
also be a syntax error), and if it reaches the end of the file with a
missing "}" or two, that it displays the location where it parsed the
nested function.
------------------------------------------------------------------------
Edit this bug report at http://bugs.php.net/?id=9250&edit=1