home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!elroy.jpl.nasa.gov!ames!network.ucsd.edu!lyapunov.ucsd.edu!mbk
- From: mbk@lyapunov.ucsd.edu (Matt Kennel)
- Newsgroups: comp.lang.misc
- Subject: Re: Small Language Wanted
- Date: 21 Aug 1992 21:08:09 GMT
- Organization: Institute For Nonlinear Science, UCSD
- Lines: 62
- Message-ID: <173lvpINNiov@network.ucsd.edu>
- References: <BtCFs9.4ox@usenet.ucs.indiana.edu>
- NNTP-Posting-Host: lyapunov.ucsd.edu
- X-Newsreader: Tin 1.1 PL3
-
- mdchaney@fractal.ucs.indiana.edu (M Darrin Chaney) writes:
- : Not to fan a flame war, but indeed C++ is _excellent_ for working with
- : complex numbers, etc. And, nobody will accuse you of using an outdated
- : language.
-
- C++: complex A, B, C;
-
- C = A + B
-
- { get A and B, call "+" operator. Create new temporary structure for
- result by calling complex constructor. Run "+" operator.
- call overloaded "=" operator. Copy into C. Delete temporary.}
-
- And can C++ optimize
-
- for (i=1; i<1000; i++) {
- <junk not altering A and B>
- C = A + B
- <more junk not altering A and B>
- func(C)
- }
-
- by taking out C=A+B as a loop invariant?
-
- How can it if the "+" and "=" operators could conceivably do *ANYTHING*
- which might possibly alter something else somewhere else.
-
- With enough effort no doubt, this problem could be fixed to make
- code that's not much worse than Fortran-IV. (The point is that
- the algebra of complex numbers and matrices and vector operations restricts
- what can happen allowing more optimization.)
-
- In case you're wondering, yes I think that OO programming can be a
- good thing, even in scientific programs, but I also believe that the
- "textbook examples" of classes, i.e. complex numbers and vectors and
- matrices are *too important* to do without special treatment. If it were
- possible to do these right, and still as special cases of a fully general
- notion, great, but that's not here today.
-
- : C is an excellent language for scientific stuff, and C++ even better.
-
- Personally, I think C is an excellent language for writing Unix
- utilities, and barely tolerable for scientific programs, useful only because
- Fortran 77 doesn't have dynamically allocatable memory and structures.
- I think that C++ really sucks. (Modula-3 and Eiffel perform that function
- better, I think).
-
- :
- : Check out the flame-war du jour in soc.college for more information on
- : how Scheme "is great|sucks" compared to C which "is great|sucks".
-
- sorry, I should contain myself....
-
-
- : Darrin
- : --
-
- --
- -Matt Kennel mbk@inls1.ucsd.edu
- -Institute for Nonlinear Science, University of California, San Diego
- -*** AD: Archive for nonlinear dynamics papers & programs: FTP to
- -*** lyapunov.ucsd.edu, username "anonymous".
-