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,1888e8caa20a2f2d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 02 Dec 2005 12:12:11 -0600 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Controlled types and exception safety References: X-Newsreader: Tom's custom newsreader Message-ID: Date: Fri, 02 Dec 2005 12:12:12 -0600 NNTP-Posting-Host: 67.169.16.9 X-Trace: sv3-5YvMmA6RRAasij2XveHSuTNPGmUVFfszDnjwjgR3JRwPJfMJJccUJqbf62tZKUReINLhxwvtjs4rmWP!8FVdFC0LNr2xgXsrkj/czKU830nJBk3RQzXXWd7Fj8cEzAICIDF7yFiCzGU4xbyex1iXLV6YBWE= X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:6720 Date: 2005-12-02T12:12:12-06:00 List-Id: > it's *my* responsibility to judge the tradeoffs for each case separately. If you want "X := Y;" to leave X unchanged if there are problems during the assignment, consider how you might handle a similar problem if you were copying an important file on disk. You would probably do something like rename X -> X.bak copy Y -> X delete X.bak so that if their was a failure during copy you could still retrieve the file's data. How about doing something similar for the stack object? type stack is ... backup_copy : access stack; Finalize then makes a backup copy (perhaps just by swapping pointers around), which Adjust then deletes when it successfuly finishes, or which Adjust's exception handler uses to restore X if there's a problem. Finalize also puts the backup_copy, with a "delete after time T" time marker, on a queue for later garbage collection if this is a "terminal" Finalize - analogous to a nightly "delete *.bak".