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
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.
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
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
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
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
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,
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
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
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 $
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]>
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
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,
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
14 matches
Mail list logo