Re: [PHP4BETA] A strict equality operator

From: Date: Sun, 25 Jul 1999 22:07:02 +0000
Subject: Re: [PHP4BETA] A strict equality operator
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-2729@lists.php.net to get a copy of this message
On Sun, 25 Jul 1999, Stig Bakken wrote: > On Sun, 25 Jul 1999, Ariel wrote: > > > On Sun, 25 Jul 1999, Jeffrey Galbraith wrote: > > > > > I've seen to many problems with the triple equality operator in the past. > > > How about := (colon equal)? This makes it more explicit and easier to > > > interpret. For instance, looking at another developer's code, sometime you > > > have to wonder if they meant to add === as opposed to ==. The := makes it > > > easier to decipher. > > > > := means assignment is a large number of languages, plus in mathamtics, so > > it's not a good choice. > > > > I agree that === is unwildly, since == and === in many cases will work the > > same, so it would not be an easy bug to spot. It should be something very > > different. $= is my suggestion. > > If we can't use "===", my suggestion is that it is made less cryptic, for > example "eq". Cryptic ones like "!=" etc. are ok because other languages > have paved way for them, but I don't think I have ever seen "$=". You never saw it cause I just made it up :) I just looked at the top row of my keyboard and looked for a symbol that wasn't already being used with = and that seemed to suggest equality. About other languages paving the way - why not be the first? Someone has to start. It's not any harder to remember then === or harder to understand, but a lot better from a debugging point of view since you're much less likely to confuse it with == (=$ might be better). I'm not hooked on the symbol, I just don't like === there are already a lot of people who think == and = were a mistake for c, and that they should have done = and := instead, so why make it worse (ok so == works well with && vs & and || vs |, but it still causes a lot of mistakes for programmers). How about x= it stands for exactly equal. -Ariel

« previous php.version4 (#2729) next »