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,7f2ce8bda9cae4ab X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news1.google.com!newsfeed.stanford.edu!news.uchicago.edu!yellow.newsread.com!netaxs.com!newsread.com!newsstand.newsread.com!POSTED.newshog.newsread.com!not-for-mail Newsgroups: comp.lang.ada Subject: Re: "Must instantiate controlled types at library level." Why? From: "Peter C. Chapin" References: <13392802.3gDeTK7ybb@linux1.krischik.com> <2780491.NPbR8AFya6@linux1.krischik.com> Organization: Kelsey Mountain Software Message-ID: User-Agent: Xnews/5.04.25 Date: Thu, 13 May 2004 10:36:28 GMT NNTP-Posting-Host: 216.114.178.171 X-Complaints-To: Abuse Role , We Care X-Trace: newshog.newsread.com 1084444588 216.114.178.171 (Thu, 13 May 2004 06:36:28 EDT) NNTP-Posting-Date: Thu, 13 May 2004 06:36:28 EDT Xref: controlnews3.google.com comp.lang.ada:533 Date: 2004-05-13T10:36:28+00:00 List-Id: Martin Krischik wrote in news:2780491.NPbR8AFya6@linux1.krischik.com: > Well, here you have a good example of the difference of Ada and C++. Ada > has a complete ban on the construct while C++ goes out and about to ban > only the tricky part. It's interesting to reflect on these different approaches. C++ can get away with imposing such restrictions on nested functions because nested functions are rarely used in C++. In Ada similar restrictions on nested procedures would be entirely unacceptable. Consequently Ada imposes restrictions in a different place in order to avoid the same fundamental problem. > Just in case you did not know: > > P is tagged .... > P_Class is access P; > C is new P .... > > A_C : C := ... > A_P : P'Class := P'Class (A_C); > A_P_Ptr : P_CLass := new P'CLass'(A_C); > > A_P and A_P_Ptr will contain a copy of C. Interesting. I don't completely follow the code above because I haven't gotten to this material yet in my study. In the statement A_P : P'Class := P'Class(A_C); Is A_C "sliced" into a P (to use a bit of C++ terminology)? I'm not certain what declaring A_P as type P'Class is doing for me. > PS: I hope you don't mind my other post to much. You do dig deeper and > you do know the ISO standard so my rant about the average C++ programmer > does not apply to you. No offense taken. Certainly C++ is a rather twisted language, especially syntactically. I'm enjoying Ada because it seems much cleaner while still being very powerful and expressive. Peter