Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.c Subject: Re: Assignment in test: OK? Message-ID: <14316:Sep1511:00:2390@kramden.acf.nyu.edu> Date: 15 Sep 90 11:00:23 GMT References: <1990Sep12.194753.9808@laguna.ccsf.caltech.edu> <3749@goanna.cs.rmit.oz.au> <1990Sep13.230805.19720@laguna.ccsf.caltech.edu> Organization: IR Lines: 21 As I understand the argument here, Bruce is saying that := vs. == is no better than = vs. ==, for if C's = had been := instead, people would have the same confusion. := does have the definite advantage that you can't mistype it in place of an == so easily, and = does have the disadvantage that if (a = b) reads well as ``if a equals b'' mathematically. To some extent, though, Bruce is right: once people think of symbol X as meaning equality, they'll try writing ``if (a X b)''. The language must catch this, no matter what X is. The symbol that people use most of the time in assignments must not return a value. As long as it does, this problem will remain. Splitting off := for assignments that do return a value is enough. People will use = except in situations like a = b := c := d, so they'll be used to = for equality. When they write if (a = b), the compiler will catch the mistake. Bruce, am I right in thinking that =/:=/== would satisfy you? ---Dan