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=unavailable autolearn_force=no version=3.4.4 Path: border2.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.fsmpi.rwth-aachen.de!news.swapon.de!fu-berlin.de!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Mon, 10 Feb 2014 12:40:29 +0100 From: "G.B." User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Need help for constrained type References: <52f3c83c$0$6559$9b4e6d93@newsspool4.arcor-online.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <52f8baa6$0$6655$9b4e6d93@newsspool2.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 10 Feb 2014 12:40:22 CET NNTP-Posting-Host: 4088b7c6.newsspool2.arcor-online.net X-Trace: DXC=il\b8^TFAHT<<0iRN7DLEQA9EHlD; 3YcR4Fo<]lROoRQ8kFZj3Rnc\616M64>ZLh>_cHTX3j]omkaYb; ReX^ X-Complaints-To: usenet-abuse@arcor.de Xref: number.nntp.dca.giganews.com comp.lang.ada:184771 Date: 2014-02-10T12:40:22+01:00 List-Id: On 07.02.14 15:11, Mike H wrote: > In message <52f3c83c$0$6559$9b4e6d93@newsspool4.arcor-online.net>, G.B. > writes >> One approximation can make use of generics. The immediate >> mention of the Len with the object declaration will not be >> present. But otherwise the approximation preserves the >> "interface" of Memory_Block, except that the .Len component >> is no longer constant, and not guaranteed to be in sync with >> the length of .Usage_Info, if someone messes with it. > Cannot sync be guaranteed by placing the relevant bits and pieces as > private types within a package such that they may only be manipulated by > functions and procedures provided by that package? Or have I > misunderstood something? I suppose the .Len component could be removed from the record entirely, and be replaced with a constant function Len .IFF. the record does not need to be some skinny collection of names to be used without functions, taking pointers and overwriting memory locations with index values/offset values. (Used from both the Ada side and from the C side.)