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: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Type_Invariant and Finalize Date: Thu, 17 Jul 2014 21:49:34 +0100 Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="5cbec41b82bafb9ba55107f02585e18b"; logging-data="1351"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19iKgEcoQcqf6bCUONS5WkpowtMVPTM7uk=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:FbMfdq4GYH+/uE8tmwXUVa/6B+w= sha1:GPGqQolLr7Xrpy52Z0IqfeExqxI= Xref: news.eternal-september.org comp.lang.ada:21023 Date: 2014-07-17T21:49:34+01:00 List-Id: Natasha Kerensikova writes: > The latest example is a sorted array of non-null > paccess-to-indefinite-type values, where the "sortedness" is a natural > type inveriant, but in Finalize I release the memory using an instance > of Unchecked_Deallocation. I don't think these can be null-excluding access types, because you can't instantiate Unchecked_Deallocation for such a type? > Or should I prepare for it, e.g. with an explicit boolean record > component that is False for the most of the lifetime of the object, > until the first call to Finalize? This approach is normal, if finalization isn't naturally idempotent. Sometimes one can use an already-present access value which, if null, means the object has already been finalized.