Re: [PHP4BETA] A strict equality operator
| From: | Jeffrey Galbraith | Date: | Sun, 25 Jul 1999 22:37:04 +0000 |
| Subject: | Re: [PHP4BETA] A strict equality operator | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-2732@lists.php.net to get a copy of this message | ||
I agree. Besides working a full time job in web technologies and writing
programming books, I teach on a part-time basis C and C++ classes at our
local college. Consistently, students fail to apply '=' and '==' properly.
Professionally, I have also seen this to be the case, which is why I am a
big advocate for keeping constants on the left for equality checks (then the
compiler finds the error for you rather than the customer). ;-)
I am not "hooked" on any other symbol, as long as it is not '==='. I dread
the time when '====' becomes available.
'===' is becoming a big problem in Javascript. The instant is was introduced
I knew it would be a big development problem, and it has. I don't want us to
make the same mistake. I think we should stand up a become a leader. Who
knows, maybe some of the "decision makers" will standardize on PHP rather
than other web languages because it is less cryptic and less prone to errors
that could be introduced by similar operators. How about '@==' or '$=='. We
could keep the double equal, since that already means equality, but let's
have some other symbol in front/behind other than another equal [please!].
Jeff
----- Original Message -----
From: Ariel <ars@ziplink.net>
To: Stig Bakken <ssb@fast.no>
Cc: Jeffrey Galbraith <xendra@xendra.com>; <php4beta@lists.php.net>
Sent: Sunday, July 25, 1999 3:07 PM
Subject: Re: [PHP4BETA] A strict equality operator
> 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
>
>
> --
> PHP 4 Beta
>
>
>
>