Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!umd5!rutgers!clyde!cbosgd!gwspc!cbcsta!n8emr!oink!jep From: jep@oink.UUCP (James E. Prior) Newsgroups: comp.lang.c Subject: Re: == vs = Message-ID: <214@oink.UUCP> Date: 17 Jan 88 17:06:26 GMT References: <626@PT.CS.CMU.EDU> Reply-To: jep@oink.UUCP (James E. Prior) Organization: Random Prime Research Institute Columbus, Ohio Lines: 41 In article <626@PT.CS.CMU.EDU> edw@IUS1.CS.CMU.EDU (Eddie Wyatt) writes: >I do not propose changing >the C language nor do I say the compiler should flag this contruct >(it is perfectly valid construct for the language which I >use myself). The language D should redefine assignment to >:= then hopefully this type of bug will go away. (ie. we should >learn from our mistakes) >Eddie Wyatt e-mail: edw@ius1.cs.cmu.edu I appreciate the choices that the authors of C made for = and ==. They chose based on which would save them typing. The single '=' was chosen for assignment because assignment is used more than comparison. Comparison got the double '=' pretty much by default. I have no problem distinguishing between = and ==, and don't want to change them at all. Nonetheless I would find changing == much less obnoxious than changing =. Like the authors of C, I find it most important to preserve a single character operator for assignment. I liken == to the very wide symbol used in mathematics a couple hundred years ago to state equality. I do realize that use of == in C for comparison is interragative as opposed to the use of the very wide symbol in ancient math being imperative. Changing == to something else like :: would make sense. I find := for assignment to be quite obnoxious. It's the worst choice I've ever seen. I understand the pressure from other languages that use it, but it is two characters long, misleading, and hideous to look at. In math : is often used for comparison, as in ratios. Using : in := for assignment misleads me to think of comparison instead of assignment. := isn't even pleasing to look at. It's downright ugly. Cyber folklore around the office has it that := originated in Europe as something that looked similar to <=. Their left pointing arrow wasn't a <, it was a legitimate left arrow that matched up with an =. Their left pointing arrow symbol was intuitive and showed the flow of data from the expression on the right side to the variable on the left. When their <= crossed the Atlantic it had to be converted to ASCII. We didn't have the same clean arrow symbol so it somehow got converted to :. We've been suffering with := ever since from a poor translation. I do appreciate the distinction you make between the C language as opposed to 'D'. -- Jim Prior jep@oink.UUCP {ihnp4|cbosgd}!n8emr!oink!jep Pseudo-programmers use pseudo-code to write pseudo-programs on pseudo-machines!