Re: "or throw new" syntax

From: Date: Sun, 05 Sep 2010 12:30:35 +0000
Subject: Re: "or throw new" syntax
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-49570@lists.php.net to get a copy of this message
On Sep 05 14:19:16, Kalle Sommer Nielsen wrote: > Hi > > Is there any reason for we don't support expressions like: > > test() or throw new Exception('test() failed'); > > > If no, is there any argument against supporting such a syntax in trunk? Technically, it should be quite easy to have that available, but it might become tricky to handle cases like: foo(throw exception()); or even "throw throw throw new Foo;" ? :) Also, I consider "or die" patterns to be a bad idea, extending it for exceptions might make it a tad bit better, but I still find that bad because of i.e. non trivial precedence rules: include("foo") or throw new Exception("ads"); it will neither include "foo" nor throw any exception. > > -- > regards, > > Kalle Sommer Nielsen > kalle@php.net > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Etienne Kneuss http://www.colder.ch

« previous php.internals (#49570) next »