Article View: comp.lang.misc
Article #1410Re: := versus ==
From: Dan Bernstein
Date: Wed, 01 Aug 1990 01:50
Date: Wed, 01 Aug 1990 01:50
22 lines
1329 bytes
1329 bytes
In article <=L-4T-A@ggpc2.ferranti.com> peter@ficc.ferranti.com (Peter da Silva) writes: > I think the best solution to this is to use ":=" for assignment and "==" for > equality. That way there would be no problem with using the wrong one in the > wrong context by accident. Q has a better solution. a == b is for comparison. Its value is 1 if they're equal, 0 if not. a := b is for assignment. It sets a to b and has value a. a = b is for assignment. It sets a to b and has no value. Advantages over straight ==/:= and over C: if(a = b) is invalid, and if(a := b) is easy to notice. You can still use = for normal assignment, so you don't get confused by the new notation. The compiler can check that *every* value is used, rather than just ignoring assignments. a = b := c := d feels and looks right. ---Dan
Technical Details
Message-ID:
<17559:Aug101:50:5290@kramden.acf.nyu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstndReferences:
<1990Jul30.143530.24295@phri.nyu.edu> <25684@cs.yale.edu> <=L-4T-A@ggpc2.ferranti.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.misc Subject: Re: := versus == Message-ID: <17559:Aug101:50:5290@kramden.acf.nyu.edu> Date: 1 Aug 90 01:50:52 GMT References: <1990Jul30.143530.24295@phri.nyu.edu> <25684@cs.yale.edu> <=L-4T-A@ggpc2.ferranti.com> Organization: IR Lines: 22 X-Original-Subject: Re: He's not the only one at it again!