IA>>A recursive function, takes a mere 13087 iterations to result in a crash and
IA>>this is a very basic example.
IA>>$i = 0;
IA>>function a() { global $i; echo ++$i."\n"; a(); }
IA>>a();
IA>>
IA>>A more complex function could take as little as 1k iterations.

Well, if so, PHP needs to be fixed to use less stack allocations. But 
anyway, rarely program logic would require a recursion 1k levels deep. 
Anyway, this is a disgression from the discussed topic.

IA>>Ok, so you propose that people start using exceptions for OO and 
IA>>procedural code just because they are "there"? One major problem with 

No, I don't propose that. I am just concerned once you put goto there it 
would be abused in all kinds of "creative" ways and would make a mess out 
of the code. 

IA>>an exception, is that once it is thrown you cannot go back to portions 
IA>>of code found within the exception block. This is why in many 
IA>>situations they are not practical for anything but fatal errors.

With goto you can't go back either - unless you make all you program logic 
be a web of goto's - which is exactly the kind of abuse I am concerned 
about.
That is not to mention that using goto _and_ exceptions (and once they are 
both there, people probably start using them anyway - how can you prohibit 
that?) would create even more messy code, unless you really restrict where 
can you put label and where can you jump. Imagine jumping inside catch 
block, for example - it may lead to all kinds of confusion.

-- 
Stanislav Malyshev, Zend Products Engineer   
[EMAIL PROTECTED]  http://www.zend.com/ +972-3-6139665 ext.115

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

Reply via email to