🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6691

Re: Common subexpression optimization

#6691
From: Piercarlo Grandi
Date: Fri, 09 Feb 1990 20:38
40 lines
2345 bytes
In article <6004@bd.sei.cmu.edu> firth@sei.cmu.edu (Robert Firth) writes:
    
    We are talking here about five or ten page subroutines containing
    some pretty complicated algebra.  Radar antenna design programs,
    for instance, can easily have expressions extending over three or
    four lines of text.
    
    This code is hard to maintain at best, but one precondition for
    readability and maintainability is that, as far as possible, the
    formula written in Algol (or whatever) look as much like the formula
    in the book as possible.  No other way can you read it, check it,
    or understand it.

Let me suggest that your book's math is poorly notated. The
problems I was talking about exist in maths as well -- a lot of
maths is very poorly notated, because it is hard to read, what's
going on is less obvious than it should be. Mathematicians are
not the only tones hat think that a pageful of index rich
formulas is macho. Physicists seem to be more concerned about
the quality of notation they use, I seem to appreciate.

Too bad that maths is often as full of bugs (even typographical
ones) as programs, or more, because of this, even if supposedly
more 'abstract'.

    If this means that I call sin(a[i,j-1]) six times in a single
    expression, so be it.

Most probably that term also has a meaning in the formula in
the book, and it should have been made evident, to aid
comprehension.

Moreover, again, if all else fails, maybe a programmer's
assistant could be employed profitably. I emphatically don't
think that it should be part of the code generator, though.

-- 
Piercarlo "Peter" Grandi           | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk
Dept of CS, UCW Aberystwyth        | UUCP: ...!mcvax!ukc!aber-cs!pcg
Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk
Technical Details
Message-ID: <1628@aber-cs.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!dcl-cs!aber-cs!pcg

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!dcl-cs!aber-cs!pcg
From: pcg@aber-cs.UUCP (Piercarlo Grandi)
Newsgroups: comp.lang.misc
Subject: Re: Common subexpression optimization
Summary: You may be translating badly notated maths, after all.
Message-ID: <1628@aber-cs.UUCP>
Date: 9 Feb 90 20:38:24 GMT
Reply-To: pcg@cs.aber.ac.uk (Piercarlo Grandi)
Organization: Dept of CS, UCW Aberystwyth
 (Disclaimer: my statements are purely personal)
Lines: 40