Re: = vs := and = vs ==
- Posted by ChrisB (moderator) May 08, 2014
- 2080 views
NO!
Never let it happen. I remember spending hours wondering why a section of code wasn't code wasn't working when a = b+c was buried within it, and groaning when I'd found it writing Delphi programs. One of the reasons I love Eu.
Chris
Not sure I agree here. It's easy to typo a = when == was meant, but typoing := in place of == would be a lot harder.
Even if we continue to refuse to allow assignment in the middle of evalutions, we could still have the new symbols, but then
if a := b+c then
would just throw a syntax error. That leaves open the possiblity of using new symbols for the sake of reader's clarity.
Hi
Its not about typing the typo, but reading and finding the typo, for instance
if a = b+c then d := e+f end if
vs
if a = b+c then d = e+f end if
or
if a := b+c then d := e+f end if
would always evaluate to true, and would be a nightmare to find.
I don't care if they're assignments or comparisons, the syntax takes care of it, but I would have to if I was forced to be more specific, which for me adds another layer of detail I can just do without.
Cheers Chris