Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-25 Thread Laruence
On Tue, Jul 24, 2012 at 9:43 PM, Andrew Faulds wrote: > On 24/07/12 14:40, Levi Morrison wrote: >> >> On Tue, Jul 24, 2012 at 7:35 AM, Nikita Popov >> wrote: >>> >>> On Tue, Jul 24, 2012 at 1:20 PM, Laruence wrote: Hi: As the previous threads disscussed, I make a implementio

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-25 Thread Xinchen Hui
On Wed, Jul 25, 2012 at 3:23 AM, Galen Wright-Watson wrote: > > > On Tue, Jul 24, 2012 at 5:03 AM, Xinchen Hui wrote: >> >> Sent from my iPhone >> >> 在 2012-7-24,19:51,Rafael Kassner 写道: >>> >>> >>> Thanks Laruence. >>> If I perform something like this: >>> function test() { >>> try { >>>

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Xinchen Hui
发自我的 iPad 在 2012-7-25,1:50,Stas Malyshev 写道: > On 7/24/12 4:20 AM, Laruence wrote: >> Hi: >>As the previous threads disscussed, I make a implemention. >> >>here is the RFC: https://wiki.php.net/rfc/finally > > I'm not seeing tests for the following situations: > 1. Return from catch blo

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Stas Malyshev
Hi! > Still my point stands. If fatal errors and die are not handled by > finally the feature does not make sense to me. You simply can't do any > kind of remotely important cleanup in there (like releasing locks > etc). Well, I'm sorry you don't understand it but I think you are too focused on e

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Stas Malyshev
On 7/24/12 4:20 AM, Laruence wrote: > Hi: > As the previous threads disscussed, I make a implemention. > > here is the RFC: https://wiki.php.net/rfc/finally I'm not seeing tests for the following situations: 1. Return from catch block. 2. Another try/catch block inside finally block. 3.

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Andrew Faulds
On 24/07/12 18:38, Stas Malyshev wrote: Hi! PHP risks losing some of its uniqueness to fixing things, unfortunately. But losing bad features and moving forward is good, right? I'm not sure what you are talking about here, but I'm sure I can not accept argument "Python does it this way, so we

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Stas Malyshev
Hi! > PHP risks losing some of its uniqueness to fixing things, unfortunately. > But losing bad features and moving forward is good, right? I'm not sure what you are talking about here, but I'm sure I can not accept argument "Python does it this way, so we must do it exactly the same way even i

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Andrew Faulds
On 24/07/12 18:31, Stas Malyshev wrote: Hi! In particular this means that... ... if a die() is execute somewhere in the try clause (or a called function) the finally clause must still be run. ... if a parse error or other fatal error occurs in the try clause (or called function) the finally cla

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Stas Malyshev
Hi! > In particular this means that... > ... if a die() is execute somewhere in the try clause (or a called > function) the finally clause must still be run. > ... if a parse error or other fatal error occurs in the try clause (or > called function) the finally clause must still be run. > ... if t

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Nikita Popov
On Tue, Jul 24, 2012 at 7:25 PM, Paul Dragoonis wrote: > I have had to workaround stuff in my PHP apps because of a lack of > finally{} block, and I hope it makes its way into the next iteration. I think it would add a lot to this discussion if you could show us what real-life use case you have t

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Paul Dragoonis
On Tue, Jul 24, 2012 at 6:20 PM, Rasmus Lerdorf wrote: > On 07/24/2012 10:01 AM, Nikita Popov wrote: > >> Another, separate point against finally is that in PHP (unlike many >> other languages) most (all?) built-in resources clean up after >> themselves. So if you open a file you don't have to wor

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Rasmus Lerdorf
On 07/24/2012 10:01 AM, Nikita Popov wrote: > Another, separate point against finally is that in PHP (unlike many > other languages) most (all?) built-in resources clean up after > themselves. So if you open a file you don't have to worry about > closing it again. It'll do that all by itself as so

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Nikita Popov
On Tue, Jul 24, 2012 at 5:16 PM, Rasmus Lerdorf wrote: >> The finally clause comes with a very strong promise that the code in >> the clause will run in absolutely any case (short of sigkill, maybe). > > No it doesn't, at least not in Java. A fatal Java error or an explicit > call to System.exit()

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Laruence
Hi: try{}finally{} implemented, https://github.com/laruence/php-src/commit/90cad0a0001ef48396146c69382a25ebe0a60474 the test scripts in that commit are examples thanks On Tue, Jul 24, 2012 at 7:41 PM, Alexey Zakhlestin wrote: > > On 24.07.2012, at 15:20, Laruence wrote: > >> Hi: >>

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Andrew Faulds
On 24/07/12 16:16, Rasmus Lerdorf wrote: On 07/24/2012 06:35 AM, Nikita Popov wrote: On Tue, Jul 24, 2012 at 1:20 PM, Laruence wrote: Hi: As the previous threads disscussed, I make a implemention. here is the RFC: https://wiki.php.net/rfc/finally any suggestions? The finally

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Rasmus Lerdorf
On 07/24/2012 06:35 AM, Nikita Popov wrote: > On Tue, Jul 24, 2012 at 1:20 PM, Laruence wrote: >> Hi: >> As the previous threads disscussed, I make a implemention. >> >> here is the RFC: https://wiki.php.net/rfc/finally >> >> any suggestions? > > The finally clause comes with a very

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Laruence
On Tue, Jul 24, 2012 at 9:35 PM, Nikita Popov wrote: > On Tue, Jul 24, 2012 at 1:20 PM, Laruence wrote: >> Hi: >> As the previous threads disscussed, I make a implemention. >> >> here is the RFC: https://wiki.php.net/rfc/finally >> >> any suggestions? > > The finally clause comes wit

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Johannes Schlüter
On Tue, 2012-07-24 at 10:37 -0400, Anthony Ferrara wrote: > > If you went by "possible", half the proposals for the language > wouldn't be accepted (password hashing, generators, goto, Class name > to scalar resolution, T_AS for closures, type hints, call-time > dereferencing, traits, classes, etc

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Anthony Ferrara
Johannes, On Tue, Jul 24, 2012 at 9:48 AM, Johannes Schlüter wrote: > On Tue, 2012-07-24 at 19:20 +0800, Laruence wrote: > > Hi: > > As the previous threads disscussed, I make a implemention. > > > > here is the RFC: https://wiki.php.net/rfc/finally > > > > any suggestions? > > > > t

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Johannes Schlüter
On Tue, 2012-07-24 at 14:50 +0100, Andrew Faulds wrote: > > As PHP has destructors there is less need for "finally" compared to > > other languages. What are the cases where an extra language construct is > > needed? (i.e. one can also use C++-like RAII things ...) > > > > The RFC is also missing t

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Andrew Faulds
On 24/07/12 14:48, Johannes Schlüter wrote: On Tue, 2012-07-24 at 19:20 +0800, Laruence wrote: Hi: As the previous threads disscussed, I make a implemention. here is the RFC: https://wiki.php.net/rfc/finally any suggestions? thanks As PHP has destructors there is less need fo

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Johannes Schlüter
On Tue, 2012-07-24 at 19:20 +0800, Laruence wrote: > Hi: > As the previous threads disscussed, I make a implemention. > > here is the RFC: https://wiki.php.net/rfc/finally > > any suggestions? > > thanks As PHP has destructors there is less need for "finally" compared to other lang

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Andrew Faulds
On 24/07/12 14:40, Levi Morrison wrote: On Tue, Jul 24, 2012 at 7:35 AM, Nikita Popov wrote: On Tue, Jul 24, 2012 at 1:20 PM, Laruence wrote: Hi: As the previous threads disscussed, I make a implemention. here is the RFC: https://wiki.php.net/rfc/finally any suggestions? Th

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Levi Morrison
On Tue, Jul 24, 2012 at 7:35 AM, Nikita Popov wrote: > On Tue, Jul 24, 2012 at 1:20 PM, Laruence wrote: >> Hi: >> As the previous threads disscussed, I make a implemention. >> >> here is the RFC: https://wiki.php.net/rfc/finally >> >> any suggestions? > > The finally clause comes wit

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Nikita Popov
On Tue, Jul 24, 2012 at 1:20 PM, Laruence wrote: > Hi: > As the previous threads disscussed, I make a implemention. > > here is the RFC: https://wiki.php.net/rfc/finally > > any suggestions? The finally clause comes with a very strong promise that the code in the clause will run in a

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Xinchen Hui
Sent from my iPhone 在 2012-7-24,19:51,Rafael Kassner 写道: Thanks Laruence. If I perform something like this: function test() { try { return 2; } catch (Exception $e) { } finally { return 3; } } What will be returned? There is no possibility to return something i

[PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Sebastian Krebs
Sorry ... to the list instead. -- Forwarded message -- From: Sebastian Krebs Date: 2012/7/24 Subject: Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions To: Laruence Hi, 2012/7/24 Laruence > On Tue, Jul 24, 2012 at 7:41 PM, Alexey Zakhle

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Sebastian Krebs
Hi, What should a return value in 'finally' mean? Regards, Sebastian 2012/7/24 Rafael Kassner > Thanks Laruence. > > If I perform something like this: > > function test() { > try { > return 2; > } catch (Exception $e) { > } finally { > return 3; > } > } > > What

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Rafael Kassner
Thanks Laruence. If I perform something like this: function test() { try { return 2; } catch (Exception $e) { } finally { return 3; } } What will be returned? There is no possibility to return something in finally, or finally will overwrite the return? On Tue, Ju

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Rick WIdmer
On 7/24/2012 5:45 AM, Laruence wrote: On Tue, Jul 24, 2012 at 7:41 PM, Alexey Zakhlestin wrote: On 24.07.2012, at 15:20, Laruence wrote: Will it work without "catch" in your implementation? nope for now. but if it is needed, I can implemente it Yes, please. -- PHP Internals - PHP Runtime

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Laruence
On Tue, Jul 24, 2012 at 7:41 PM, Alexey Zakhlestin wrote: > > On 24.07.2012, at 15:20, Laruence wrote: > >> Hi: >>As the previous threads disscussed, I make a implemention. >> >>here is the RFC: https://wiki.php.net/rfc/finally >> >>any suggestions? > > Will it work without "catch" in

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Paul Dragoonis
On Tue, Jul 24, 2012 at 12:20 PM, Laruence wrote: > Hi: > As the previous threads disscussed, I make a implemention. > > here is the RFC: https://wiki.php.net/rfc/finally > > any suggestions? > > thanks > > -- > Laruence Xinchen Hui > http://www.laruence.com/ > > -- > PHP Internals -

Re: [PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Alexey Zakhlestin
On 24.07.2012, at 15:20, Laruence wrote: > Hi: >As the previous threads disscussed, I make a implemention. > >here is the RFC: https://wiki.php.net/rfc/finally > >any suggestions? Will it work without "catch" in your implementation? try { doSomethingDangerous(); } finally {

[PHP-DEV] [RFC] Supports 'finally' keyword for PHP exceptions

2012-07-24 Thread Laruence
Hi: As the previous threads disscussed, I make a implemention. here is the RFC: https://wiki.php.net/rfc/finally any suggestions? thanks -- Laruence Xinchen Hui http://www.laruence.com/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.ph