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=1.3 required=5.0 tests=BAYES_00,INVALID_MSGID, MSGID_RANDY autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,88e7ef9008757431 X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Function Calls by Address Date: 1999/09/03 Message-ID: <7qp8sd$u8i$1@nnrp1.deja.com>#1/1 X-Deja-AN: 520705243 References: <37CADE68.6AF06F5D@escmail.orl.lmco.com> <37CEEFFA.7D73F78D@magic.fr> <7qooh7$hbh$1@nnrp1.deja.com> <37CFFEA6.921CBE59@magic.fr> X-Http-Proxy: 1.0 x43.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Fri Sep 03 19:51:46 1999 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-09-03T00:00:00+00:00 List-Id: In article <37CFFEA6.921CBE59@magic.fr>, Francois Godme wrote: > I knew about the nested procedures restriction but thought > that no one still uses nested procedures. An amazingly narrow thought. It is true that people who don't have them (who use languages starting with the letter C) don't use them, but then COBOL programmers don't use dynamic allocation :-) > Personally, I have stopped using them. Wh will I hide a > perfectly useful procedure inside another when all I want > is to spare me rewriting over and over the same thing. If you think this is all procedures are good for, you are missing a lot! I usually tell my students that if they see a large program which does NOT have cases of procedures that are called only once, it is likely that the design is incompetent! > Are nested > procedures coming from the Pascal heritage where everything > was residing > inside the main program? No, not at all, and if you ask the question, then it means, as above, that you are missing a lot! Nested procedures are used when solution of a problem requires functional decomposition on a local level, and the resulting procedures that come from that functional decomposition are relevant only locally, so you do not want to pollute name spaces. Furthermore, non-local references are a powerful mechanism for many purposes. In particular, the lack of thread safety of many run-time routines in the C library can be ascribed to the excessive use of global variables that would much better be local variables referenced non-locally where necessary. Nested procedures are a very powerful feature of Ada. If you have stopped using them, you probably never fully understood how to make good use of this feature. > By the same matter, who is still using the > 'separate' construct for writing new applications? Anyone who understands the power of this capability. It is quite true that Ada 95 replaces SOME of the need for subunits by child units, but only some. During the design of the modules extension for Algol-68 (done by Hendrick Boom, Charles Lindsey, and Robert Dewar) we furiously tried to unify the notions of top down and bottom up decomposition, and finally decided that it was simply not cleanly possible. That is why the final proposal includes two separate but related facility. This is one area where the Ada design drew directly from the Algol-68 work, so in some sense this Algol-68 design was the genesis for the subunit notion. If you never use subunits, then again, you probably have not fully understood the power of this feature. Not everyone has to use everything, and indeed it is often the case that you simply don't learn everything, and manage to live without things you have not learned. But don't make the jump of thinking that because you don't see that particular features are useful, they must be useless. It is more likely that you are missing something. There was a pretty fierce attempt to remove all useless features from both Ada 83 and Ada 95, so if something exists in the design, it means there was a strong constituency with good arguments for its inclusion. So if you don't know any good arguments in favor of a given feature, it does not mean they don't exist, it just means you are not familiar enough with the particular feature. Robert Dewar Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.