Newsgroups: | comp.compilers |
From: | bobduff@world.std.com (Robert A Duff) |
Keywords: | C++, optimize, Ada |
Organization: | The World Public Access UNIX, Brookline, MA |
References: | 95-07-068 95-08-091 |
Date: | Wed, 16 Aug 1995 00:54:40 GMT |
Henry Baker <hbaker@netcom.com> wrote:
>Ada's most objectionable feature, by far, IMHO, is its holier-than-thou
>attitude regarding programming style. Ada goes to a lot of trouble to
>disallow features, constructs, orders of declaration, etc., based not
>on any technical issues, but on some misguided notions about what makes
>good programming style. Indeed, the compiler vendors have to go to
>considerable _extra_ effort to disallow these things.
I agree. Ada 95 is considerably better in this regard than Ada 83 was,
however. For example, the annoying rule about order of declarations has
been removed. Unfortunately, there are still some "stylistic" rules
left -- for example, it's still illegal for a function to have an 'out'
parameter, which is very annoying. Nonetheless, I think Ada 95 is a lot
more friendly in this regard.
- Bob
P.S. I was on the Ada 95 language design team, and I pushed hard against
the "holier-than-thou" attitude you complain about.
P.P.S. Back to the subject at hand (order of evaluation). The rule in
Ada (83 and 95) is that the actual parameters are evaluated in an
arbitrary order, but not in parallel, and not interleaved. I believe
that C++ has the same rule.
I'm not sure this is the best rule -- if I were designing a language
from scratch, I think I would probably specify strictly left-to-right
order, for the reasons various people have stated in this thread. I
wonder if it's possible to design the language so that the compiler has
a better idea of exactly which sub-expressions have side-effects, and
what those side effects are. (Ada and C++ pretty much require the
compiler to assume the worst, for a call to a separately compiled
function.) If the compiler had more information, and the rule was
left-to-right, the compiler could still re-order, and even parallelize,
in many cases, having proven that this is equivalent. Anybody know of
languages that have this property?
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.