On Fri, Apr 29, 2011 at 7:04 AM, Stas Malyshev <smalys...@sugarcrm.com>wrote:
> Hi! > > > yeah, but usually you return null/false in case of error when you write >> procedural code. >> > > Nope. I use it all the time when writing OO code and when "nothing" or "no > object" or "can't do this" is a valid answer for a function to return. > > > but since we wouldn't support the return typehint for scalars, maybe we >> could assume that the only sane people who would use this feature would >> also do the error handling will through Exceptions (@throws :P). >> > > Exceptions are for _exceptional_ situations. If you query a DB for an > object and there's no object like this, you don't want an exception if this > situation is normal and handled in your code - you want a null or false or > something like that. Exception is for situations that you code can not > foresee or handle, they are not for regular data flow control. > > some agree, some disagree with that. http://barelyenough.org/blog/2007/11/when-to-use-exceptions/ Tyrael