[ ... ]
Hey -- there are more important things to optimize than clock-
cycle counts. I too am old enough to have learned FORTRAN IV,
and let's not kid the kids: FORTRAN IV sucked! Wasting a few
machine cycles is one thing, but don't waste large amounts of my
time and claim to be doing me a favor.
This was posted as a follow-up to my article, but seems to have been
based on entirely ignoring everything I wrote.
I have not at any point advocated Fortran as a cure for anything (at
least not in the last 20 years). While others in the thread have
claimed that if Fortran IV was still in use that optimization would be
improved, I have NOT done so, and in fact have specifically stated
that I believe this to be mostly wrong.
I've also stated that even though hand optimization makes a greater
difference percentage-wise than it did back then, that I no longer do
so nearly as often as I did then. I would have thought that made it
fairly obvious that I consider it less important than I did then.
How bad did FORTRAN IV suck? Well, my favorite example is that
a for-loop (actually a "DO" loop in FORTRAN IV) could not
execute its body zero times. Even if the condition was false at
the start, it would go through at least once. Is that as
awkward as it sounds? Absolutely! Why did they do it? Well,
the way most machine instruction sets work, one can save a cycle
or two by testing the condition at the end of the loop, and
using a conditional jump backwards.
IMO, in the pantheon of Fortran's shortcomings, this is one of the
lesser evils. Nonetheless, since I haven't advocated Fortran, arguing
against it is irrelevant.
We have much more *efficient* languages today. C and C++ are
far from top of the list. Java doesn't crash, but it's still
notably primitive. My hope for the future is with elegant,
polymorphic-type-safe languages, such as the ML family, or
perhaps even more purely functional languages such as Haskell.
They have yet to make a commercial splash comparable to C/C++ or
Java, but when tested in coding-competition, they romp.
I'd class functional programming right along with the verification it
enables: it's the future of programming; always has been and always
will be.
Seriously, while I _like_ a number of functional languages quite a
lot, none of them I've used yet really works particularly well for
most of the real work I do. Then again, I largely do system
programming, rather than typical applications.
Perhaps we're finally reaching the point at which the programming
world will start to recognize that there are differences between
system programming and application programming, and using system
programming languages like C and C++ for application programming isn't
particularly productive. To a limited extent that's already happened,
but it's still done on a regularly basis anyway.
Truthfully, I'm as much a culprit in this respect as anybody -- for
anything but a truly colossal task, my familiarity with C++ tends to
outweigh the advantages of other languages, I typically use it even in
situations where another language would provide some advantages.
Then again, C++ does have one advantage in this respect: it supports
enough different levels of abstraction that it can be used right down
to the metal, or in a fairly safe, high-level manner, and perhaps most
importantly, more or less seamlessly marrying the two, so even in my
system programming, much of what I write works at a fairly high level
of abstraction.
In my own grad-school work with ML, I fought long and hard with
the type-checker. I could take an hour or more just to several
dozen lines of my code to compile. Still, I like ML; when
programs did compile, they worked. Logic errors are, or course,
still possible, and I cannot be certain my programs were
entirely correct. Nevertheless, I'm impressed: in about a year
of using ML, *every* known error in my code was caught at
compile-time.
I'm afraid my experience with functional programming hasn't been quite
so positive. In the end, I think even if functional programming did
provide huge benefits, it _probably_ wouldn't take over any time soon
anyway.
I suspect that the majority of code in the world today is still
written in COBOL and Fortran, and if we can't even get the world
beyond them, the possibility of functional programming becoming
mainstream anytime soon seems remote indeed.