From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a1f67187d079c901 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-16 22:26:00 PST Newsgroups: comp.lang.ada Path: bga.com!news.sprintlink.net!howland.reston.ans.net!europa.eng.gtefsd.com!MathWorks.Com!news2.near.net!noc.near.net!inmet!dsd!bobduff From: bobduff@dsd.camb.inmet.com (Bob Duff) Subject: Re: Is Ada the future? [was: Is C++ the future?] Message-ID: Sender: news@inmet.camb.inmet.com Organization: Intermetrics, Inc. References: <1994Oct13.144031.7290@swlvx2.msd.ray.com> <37k80c$puh@network.ucsd.edu> <1994Oct14.103430@di.epfl.ch> Date: Fri, 14 Oct 1994 20:43:01 GMT Date: 1994-10-14T20:43:01+00:00 List-Id: In article <1994Oct14.103430@di.epfl.ch>, >mbk@inls1.ucsd.edu (Matt Kennel) writes: >|> The core issue: doing this should be possible. (Indeed it >|> was hard for me to imagine that it should ever have been >|> not possible). >|> >|> -- Obvious Eiffel construction. >|> class ONE is >|> a:TWO; >|> end; >|> >|> class TWO is >|> b:ONE; >|> end; I think at least part of the reason Ada makes this a bit harder than some other languages is that in Ada, declarations contain a lot of executable code. For example: X: Integer range 1..Function_Call(...) := Other_Function_Call(...); Since declarations have a lot of run time semantics, there needs to be a well-defined order in which the declarations get executed ("elaborated" in Ada jargon). Given this implied run-time ordering, forward references are a Bad Thing. Hence the need for incomplete type declarations, and the restriction that they don't work across multiple library units. Note that for multiple library units, the order is implied by the with_clauses, and is really only a partial order. Languages that freely allow forward references usually do not have any way to initialize variables at their declaration point, or else they restrict the expressions to very simple forms that can be known at compile time, so the issue of run-time execution doesn't come up. Certainly initializing a variable with a function call can be useful. Would it be worth it to sacrifice that in order to achieve a slightly simpler method for doing mutual recursion across multiple library units? I don't know. It's a trade-off. Note also that the designers believed that the linear elaboration model also makes the code more readable -- at least in theory, it allows you to read your program in order, and you won't run across references to things you've never heard of. - Bob -- Bob Duff bobduff@inmet.com Oak Tree Software, Inc. Ada 9X Mapping/Revision Team (Intermetrics, Inc.)