Re: [RFC] Combined Comparison (Spaceship) Operator

From: Date: Fri, 23 Jan 2015 23:46:14 +0000
Subject: Re: [RFC] Combined Comparison (Spaceship) Operator
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-81057@lists.php.net to get a copy of this message
Hi Stas, > On 23 Jan 2015, at 23:42, Stanislav Malyshev <smalyshev@gmail.com> wrote: > >> The only reasonable behavior for <==>, <==, >== would be raising >> error/exception if type differs. >> E_RECOVERABLE_ERROR may be used. > > Comparison operators raising exceptions doesn't sound like a very nice > thing to work with. I agree. As I’ve already mentioned, I have used (sometimes still do use) the relatively obscure Game Maker Language, which made this mistake. 1 == “1” is an error, “1” < 1 is an error, and so on. It is incredibly impractical, especially since you’ll sometimes get the “wrong” type when errors happen, just like how in PHP a function might return FALSE or NULL if it’s given the wrong arguments. Compare that value, and bam, your game just crashed! I really don’t think we should make the mistake of copying GML here. Thanks. -- Andrea Faulds http://ajf.me/

« previous php.internals (#81057) next »