Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!swbatl!texbell!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: comp.lang.misc Subject: Re: := versus == Message-ID: Date: 8 Aug 90 16:55:59 GMT References: <=L-4T-A@ggpc2.ferranti.com> <17559:Aug101:50:5290@kramden.acf.nyu.edu> <7H+4AM6@xds13.ferranti.com> <1990Aug2.170110.28208@rice.edu> Reply-To: peter@ficc.ferranti.com (Peter da Silva) Organization: Xenix Support, FICC Lines: 22 In article <1990Aug2.170110.28208@rice.edu> preston@titan.rice.edu (Preston Briggs) writes: > With C, Q, and PL/M, this doesn't hold. > (i := 1) + i is not always equal to i + (i := 1) Oh, it's worse than that. (i := 1) + i is not always equal to (i := 1) + i, depending on optimisation level, or (for a sufficiently clever optimiser) surrounding code. I can even imagine cases where the same expression twice in a row produces different results. > Same problems with ++ and -- in C. And with any function that has a side effect. Like you say... > Same problem in lots of languages where people write functions > with side-effects. As, for example, any object oriented language where objects have internal state. Like, about all of them. A language that prevents functions from having side effects is likely to be pretty restrictive. Can you think of one, other then purely functional languages? Functions couldn't have I/O, or for that matter call procedures (since procedures can have side effects). -- Peter da Silva. `-_-' +1 713 274 5180. 'U`