Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!hsdndev!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.misc Subject: Re: Fortran vs. C for numerical work - expression notation Message-ID: <914:Dec923:50:2990@kramden.acf.nyu.edu> Date: 9 Dec 90 23:50:29 GMT References: <16798@csli.Stanford.EDU> <8339@lanl.gov> Organization: IR Lines: 79 In article <8339@lanl.gov> jlg@lanl.gov (Jim Giles) writes: [ Jim paraphrases Peter's position: ] > programming notation should not closely resemble standard math because > such a thing was misleading to novice programmers. I hope you agree > that such a position is indefensible. The arguments that programming notation should look like math notation are suspiciously like the arguments for visual (i.e., WYSIWYG) document design. The counterarguments are very much like the arguments for logical document design. Didn't the Bulletin recently carry a rather convincing series on the superiority of logical document design? [ C has prefix pow(a,b), Fortran has infix a**b ] [ Bill calls this an ``awfully small difference'' ] [ Jim responds: ] > Well, there's a lot of different meanings to the phrase "awfully small > difference". [ blah blah blah ] > Any difference from such standard notation is an impediment - period. Jim, how is a**b more ``standard mathematical notation'' than pow(a,b)? How is a.gt.b more ``standard mathematical notation'' than a > b? Most professional Fortran programmers groan when they hear that Fortran 8X (oops, 9X) has a > b. Maybe ``standard mathematical notation'' isn't as important as familiar notation... > We can only hope that as character sets get larger (my > workstation has dozens of fonts and hundreds of characters) and as > higher-level languages become available, the computational notation > available to scientists will converge with their own standardized > professional notations. I sure hope not. The computer treats complex types quite differently from integer types, and I want to be reminded of that difference when I'm programming. Until a computer can *do* mathematics I don't want to pretend that it can *talk* mathematics. I agree entirely that Macsyma and friends should imitate standard mathematical notation when they're doing standard mathematics. > You fail to point out that both languages (but C more than Fortran) > use standard mathematical symbols for non-standard purposes. The > equal sign in both languages is used for assignment, for example. > Again, this is an impediment. Again, C suffers from it worse than > Fortran. How is = a ``nonstandard'' symbol for assignment? If you think of your computer as a sequence of states, then x = y + z is a quite natural way to say ``x in the next state equals y + z in this state, with everything else the same.'' So is x <- y + z: ``Store y + z in x.'' Or x -> y + z: ``x changes to y + z.'' If any of these is ``standard'', it's the first one, but the concept is expressed so differently in mathematics that I can't believe you consider any language notation better than any other. > You fail to mention that both languages use non-standard symbols for > standard mathematical concepts. Fortran uses '.and.' for conjunction, > while C uses '&', for example (the standard symbol for conjunction is, > of course, '/\'). Spoken like a true computer scientist. The traditional symbol for conjunction was ``&''. The most popular way to express conjunction (for English speakers) has always been the word ``and''. That pseudo-Lambda and similar abominations are relatively recent inventions still not very popular outside mathematical logic. > Now, the final point that most of the people in this discussion (on > _both_ sides) seem to miss is this: _any_ change or impediment is > unjustifiable unless it confers some _advantage_. Beautifully convoluted rhetoric. What is your point? Neither Fortran nor C uses particularly ``standard'' mathematical notation, because programming is not particularly ``standard'' mathematics. There is no reason this situation should change, and it is not a mark against either language that certain concepts are expressed somewhat differently. ---Dan