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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no 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!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.freenet.de!feed.news.tiscali.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: "Must instantiate controlled types at library level." Why? Date: Thu, 13 May 2004 13:18:11 +0200 Organization: AdaCL Message-ID: <11924003.IfRfnULeIG@linux1.krischik.com> References: <13392802.3gDeTK7ybb@linux1.krischik.com> <2780491.NPbR8AFya6@linux1.krischik.com> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1084449507 02 13477 Beh2GKK15lp17zH 040513 11:58:27 X-Complaints-To: usenet-abuse@t-online.de X-ID: rGz89BZpgeLWS5YLdjID6rx8xeRIi-LdAn6+2wcyBw7mFtG867-mgj User-Agent: KNode/0.7.7 Xref: controlnews3.google.com comp.lang.ada:536 Date: 2004-05-13T13:18:11+02:00 List-Id: Peter C. Chapin wrote: > Martin wrote in > news:2780491.NPbR8AFya6@linux1.krischik.com: > 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. If you think of slice as something being cut away then: No! P is an definite type. For any definite type the size is know at compile time. For any tagged type a 'Class type exists. 'Class are indefinite types (like String). For any indefinite type the size is may or may not be known at compile time and if needed is calculated (by compiler magic) at run time. The trick is that a 'Class type can contain any type from the class hirachie it is part of. Thats why they are called class wide. The compiler will calculate the size of C at and make enough space on the stack so that C can be copied into P'Class. I almost never use pointers in Ada since I can pass 'Class types around as I like. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com