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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,99f33f51845a7793 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-20 10:45:05 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!sn-xit-01!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: 'withing' problem [code generation] Date: Tue, 20 Nov 2001 13:43:15 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3be27344$0$227$ed9e5944@reading.news.pipex.net> <3BE42900.7590E899@adaworks.com> <3be65f4c$0$237$ed9e5944@reading.news.pipex.net> <3BF6E4DF.FA47ACDB@adaworks.com> <3BF93F0F.D5E4D0B7@Raytheon.com> <3BFA6BDC.26E7557E@Raytheon.com> <3bfa84ca$0$8514$ed9e5944@reading.news.pipex.net> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:16738 Date: 2001-11-20T13:43:15-05:00 List-Id: "David Crocker" wrote in message news:3bfa84ca$0$8514$ed9e5944@reading.news.pipex.net... > It's not hard to come up with a system that makes the order of C++ include > files unimportant. Our product currently generates C++ (we would like to > generate Ada, which is why I started this thread) so we needed just such a > scheme. You have to forward declare the types in C++ too: //chicken.hpp class Egg; class Chicken { public: void lay(Egg&); }; //egg.hpp class Chicken; class Egg { public: void layer(Chicken*&) const; }; > The nicest solution is the one used by Java (and by our own product) - no > restriction at all on forward referencing classes/types, or on packages > referring to each other (except for absurd cases like 2 classes inheriting > from each other). This is the way all programming languages should go, IMO. That's swell. Why don't you post this on comp.lang.c++ and see what the reaction is. My hunch is that most C++ programmers won't be sympathetic. You cannot compare static languages like Ada95 and C++ to dynamic languages like Java or Eiffel. They were designed to solve different problems, and hence reflect different philosophies. > Forward-declarations should be considered obsolete - they only exist to make > life easier for the compiler writer, and compiler technology has come a long > way now. It's called "type-checking." The rule is that an entity has to be declared before being used. This is a deliberate feature of the language, and it's there because the language designer wanted it to be there. It has nothing to do with compiler technology (since you could have easily designed the language without that feature).