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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,37d1760a19f7ae57 X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Q. on Automatic Package Finalization Date: 1996/09/23 Message-ID: #1/1 X-Deja-AN: 184989589 references: <523tt4INNlu7@snoopy.cis.ohio-state.edu> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-09-23T00:00:00+00:00 List-Id: iDave said "Hi. Does anyone know of a good way to achieve automatic package finalization in Ada95? I'd like to create a generic package which automatically cleans up its package instance state (possibly including allocated memory, temporary files, etc.) when the package scope ends. The code below (which compiles under GNAT 3.05) is one attempt to achieve this using controlled types. It requires that the representation of state for package P instances be incorporated into an instance (pkg_var) of a controlled type (PC.T) declared in a library-level package (PC). This is not a very satisfactory solution even if it would work. Does anyone have some better ideas for handling automatic package finalization?" This seems a perfectly reasonable approach, and indeed it was knowing that this approach existed that made it seem unwise to clutter the language with yet another feature for handling this case specifically.