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,73e5f80245e6297 X-Google-Attributes: gid103376,public From: stt@houdini.camb.inmet.com (Tucker Taft) Subject: Re: Chunks of finalized Date: 1997/10/06 Message-ID: #1/1 X-Deja-AN: 278266106 Sender: news@inmet.camb.inmet.com (USENET news) X-Nntp-Posting-Host: houdini.camb.inmet.com References: Organization: Intermetrics, Inc. Newsgroups: comp.lang.ada Date: 1997-10-06T00:00:00+00:00 List-Id: Robert A Duff (bobduff@world.std.com) wrote: : ... : Why wait until the next Push (which might be a long time, or never)? : Inside the generic, you could declare: : type Stack_Element_Holder(Present: Boolean := False) is : record : case Present is : when False => null; : when True => The_Element: Stack_Element_Type; : end case; : end record; : And then build the stack out of arrays of these things. Then, whenever : you Pop, assign a "Stack_Element_Holder'(Present => False)" into the : vacated slot. I think this achieves what the original poster wanted -- : it will call Finalize on The_Element (if its controlled), and it will : also call Finalize on all controlled subcomponents of The_Element. And : there's no need to pass in an extra finalization operation, nor to : handle subcomponents by hand. It costs an extra Boolean component for : every stack element, though. It might be easier to just take an extra generic IN parameter, an "Empty_Value" of the Stack_Element_Type. This value could be used to initialize and reinitialize the stack elements. : - Bob -- -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ Intermetrics, Inc. Burlington, MA USA