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-Thread: 103376,9fb8e2af320d5b3e X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed01.chello.at!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Sat, 30 Jun 2007 14:33:24 +0200 From: Georg Bauhaus Organization: # User-Agent: Thunderbird 1.5.0.12 (Macintosh/20070509) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Bus error References: <1182954233.788124.17920@c77g2000hse.googlegroups.com> <1182959120.13096.8.camel@kartoffel> <1182964748.689146.52490@c77g2000hse.googlegroups.com> <1183061209.600996.74710@k79g2000hse.googlegroups.com> <1183104348.439715.173430@q75g2000hsh.googlegroups.com> <4684d358$0$14887$9b4e6d93@newsspool4.arcor-online.net> <1183136362.395300.27850@x35g2000prf.googlegroups.com> In-Reply-To: <1183136362.395300.27850@x35g2000prf.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <46864cc9$0$23135$9b4e6d93@newsspool1.arcor-online.net> NNTP-Posting-Date: 30 Jun 2007 14:30:01 CEST NNTP-Posting-Host: 819d121f.newsspool1.arcor-online.net X-Trace: DXC=:m9h^QfgT7M0YVY]kmLTlDic==]BZ:afN4Fo<]lROoRAFl8W>\BH3YBZ7ndf4S17[EA:ho7QcPOVCgMAOmdVN:JNk4^A6b>LFAA X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:16351 Date: 2007-06-30T14:30:01+02:00 List-Id: Adam Beneschan wrote: > On Jun 29, 2:42 am, Georg Bauhaus wrote: >> Maciej Sobczak wrote: >> >>> Yes, or even stricter: >>> with Ada.Finalization; use Ada; >>> package P is >>> type T (<>) is limited private; >>> private >>> type T is new Finalization.Limited_Controlled with ...; >>> end P; >>> which prevents uninitialized objects. >> Uhm, it prevents uninitialized objects that cannot otherwise >> have default initialisation (e.g. from function calls whose >> results are assigned to components), or initialisation via Initialize. >> Such as records that need their components initialised with >> values known only at run time *and* defined at library level etc. > > I'm not sure what you mean here... For packages that can only see the > partial view of T, T is an indefinite type, and you cannot declare a > variable of type T without an initialization expression (3.3.1(5)). I > think that's what Maciej was referring to. (Yes, a private child > package of P could declare a variable of type T without an > initializer, but I don't think he was referring to those.) I was only thinking of guaranteed initialisation of an object of a limited type T that is declared just anywhere even when it is not explicitly initialised. The idea being that T then doesn't necessarily need (<>) in its public view because T's default initialization might take care of all components via type T is limited ... Xyz_Part : D := Init_All_Copmonents(T'access, ...); This, I thought, is made possible through the venerable mechanisms "limited" and visibility control. That is, just like we can make a no-argument constructor of a Java class call methods on "this", we can make variables of a limited type T call functions on "T'access" (by not using an Ada 2005 constructor function in this case). And I'm glad that we can now have aggregates of limited types for building connected (partially) immutable data structures in source. And all kinds of constants of limited types.