On 3 Jan 2012 at 19:01, Fred Cisin wrote:
On Tue, 3 Jan 2012, Dave McGuire wrote:
> A very early memory of mine was reading a BASIC program for the
> first
> time. I saw a line like this:
> 40 A = A + 1
> ...and I remember being very confused, saying "no, it isn't!!"
> Pascal's assignment operator does little to address this, and
> APL's
> does it well, but since all it took was reading like two sentences
> in a book to learn what was going on, it seems this isn't really a
> big problem in search of a solution.
And the number of times that I've seen the = used in C conditionals
instead of == is amazing. I note that many writers have adopted the
"if ( constant == expression)" form rather than the somewhat more
intuitive "if ( expression==constant)" just to catch this kind of
error.
Say what you want about FORTRAN, but the .EQ. conditional test could
never be mistaken for an assignment. When I first saw the BASIC
conditional of = for equality testing, I told myself "There's going
to be trouble there."
Then we could wander off into Verilog syntax and go on about the
common error of using = instead of <=. But we all know that Verilog
isn't a programming language.... :)
--Chuck