Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread Michael B Allen
The most common scenario for try / finally is to release some resources regardless of whether or not an exception occurred. For example: try { $r = new Something(); $r->doStuff(); } finally { $r->cleanup(); } So $r->cleanup() will run regardless of whether or not the try

Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread John Campbell
On Tue, Aug 5, 2008 at 11:14 AM, Justin Dearing <[EMAIL PROTECTED]> wrote: > So your saying finally could be implemented as > > if($e != null){ > //finally stuff > } > Not quite. A finally block is supposed to execute no matter whether an exection occurs and regardless of whether it is caught.

Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread Guilherme Blanco
http://wiki.php.net/todo/php60 Check out the Dropped Items. Cheers, On Tue, Aug 5, 2008 at 12:38 PM, Justin Dearing <[EMAIL PROTECTED]> wrote: > If a finally patch was rejected on principle, I'd like to see the > rejection explanation. > > On Tue, Aug 5, 2008 at 11:31 AM, Guilherme Blanco > <[E

Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread csnyder
On Tue, Aug 5, 2008 at 11:24 AM, Justin Dearing <[EMAIL PROTECTED]> wrote: > On Tue, Aug 5, 2008 at 11:18 AM, Guilherme Blanco > <[EMAIL PROTECTED]> wrote: >> exactly =) > > Adding a key word would make code more readable. Just like the using > keyword is redundant in C#, but still useful. Adding

Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread csnyder
On Tue, Aug 5, 2008 at 11:14 AM, Justin Dearing <[EMAIL PROTECTED]> wrote: > So your saying finally could be implemented as > > if($e != null){ > //finally stuff > } > So for those of us who "grew up" on PHP, this is to handle cases when an exception was caught somewhere in the try block, but no

Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread Justin Dearing
If a finally patch was rejected on principle, I'd like to see the rejection explanation. On Tue, Aug 5, 2008 at 11:31 AM, Guilherme Blanco <[EMAIL PROTECTED]> wrote: > I agree too =) > > Maybe I should spend some time looking at PHP source and try a patch. > I know it was rejected due to PHP b

Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread Guilherme Blanco
I agree too =) Maybe I should spend some time looking at PHP source and try a patch. I know it was rejected due to PHP being a dynamic language or something similar, can't remember the exact reason. Cheers, On Tue, Aug 5, 2008 at 12:24 PM, Justin Dearing <[EMAIL PROTECTED]> wrote: > On Tue,

Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread Justin Dearing
On Tue, Aug 5, 2008 at 11:18 AM, Guilherme Blanco <[EMAIL PROTECTED]> wrote: > exactly =) Adding a key word would make code more readable. Just like the using keyword is redundant in C#, but still useful. ___ New York PHP Community Talk Mailing List http

Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread Guilherme Blanco
exactly =) On Tue, Aug 5, 2008 at 12:14 PM, Justin Dearing <[EMAIL PROTECTED]> wrote: > So your saying finally could be implemented as > > if($e != null){ > //finally stuff > } > > > On Tue, Aug 5, 2008 at 11:09 AM, Guilherme Blanco > <[EMAIL PROTECTED]> wrote: >> You can do an ugly hack sup

Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread Justin Dearing
So your saying finally could be implemented as if($e != null){ //finally stuff } On Tue, Aug 5, 2008 at 11:09 AM, Guilherme Blanco <[EMAIL PROTECTED]> wrote: > You can do an ugly hack supported: > > > try { > // ... > } catch (Exception $e) { > // ... > } > > // finally... you can use $

Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread Guilherme Blanco
You can do an ugly hack supported: try { // ... } catch (Exception $e) { // ... } // finally... you can use $e here, you know?!!?!? =) Cheers, On Tue, Aug 5, 2008 at 11:56 AM, Justin Dearing <[EMAIL PROTECTED]> wrote: > On Tue, Aug 5, 2008 at 10:50 AM, David Mintz <[EMAIL PROTECTED]>

Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread Justin Dearing
On Tue, Aug 5, 2008 at 10:50 AM, David Mintz <[EMAIL PROTECTED]> wrote: > > > On Tue, Aug 5, 2008 at 10:37 AM, <[EMAIL PROTECTED]> wrote: >> >> I've been using exceptions more in PHP. I've found some fun things >> lately, like how to reroute errors, warnings and notices as exceptions. >> It bugs

Re: [nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread David Mintz
On Tue, Aug 5, 2008 at 10:37 AM, <[EMAIL PROTECTED]> wrote: > I've been using exceptions more in PHP. I've found some fun things > lately, like how to reroute errors, warnings and notices as exceptions. > It bugs me a lot that PHP doesn't support 'finally', however, because I've > found that,

[nyphp-talk] "Finally" missing in PHP...

2008-08-05 Thread paul
I've been using exceptions more in PHP. I've found some fun things lately, like how to reroute errors, warnings and notices as exceptions. It bugs me a lot that PHP doesn't support 'finally', however, because I've found that, overall, it's better than catch... http://gen5.info/q/2008/07