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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d067a5a7c60c3b40 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!y80g2000hsf.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Unchecked_Deallocation vs. delete Date: 10 May 2007 13:09:31 -0700 Organization: http://groups.google.com Message-ID: <1178827771.416316.210790@y80g2000hsf.googlegroups.com> References: <1178728045.890171.6110@q75g2000hsh.googlegroups.com> <1hzydt9ej6az6$.12jl0su9budun.dlg@40tude.net> NNTP-Posting-Host: 85.0.248.253 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1178827771 6775 127.0.0.1 (10 May 2007 20:09:31 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 10 May 2007 20:09:31 +0000 (UTC) In-Reply-To: <1hzydt9ej6az6$.12jl0su9budun.dlg@40tude.net> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: y80g2000hsf.googlegroups.com; posting-host=85.0.248.253; posting-account=Ch8E9Q0AAAA7lJxCsphg7hBNIsMsP4AE Xref: g2news1.google.com comp.lang.ada:15738 Date: 2007-05-10T13:09:31-07:00 List-Id: On 9 Maj, 19:02, "Dmitry A. Kazakov" wrote: > > What's the benefit of Unchecked_Deallocation as a generic library > > procedure vs. built-in deallocation operator like delete in C++? > > To make it harder to use. Why not make a Very_Hard_To_Use_Unchecked_Deallocation_Built_In_Operator instead? I'm not asking about the spelling (which is ugly for purpose), but about category. > > The disadvantage, as far as I perceive it, is that it breaks the > > symmetry that should be expected with regard to the allocation > > operation. If "new" is built-in, then the deallocation should be built- > > in as well. > > The symmetry is apparent. Pointers can be constructed using two methods: > new T and X'Access. Then put a run-time check in this Very_Hard_..._Operator. Or, why not making separate "subtypes" of pointers? One would be a specialization of pointers for X'Access and another for new T. You would need to use the "subtype" for new T to deallocate, or the compiler would spank you and the downcast to this "subtype" (if ever needed) would be a perfect place for the run-time check. (this is a wild idea, but seems to be more in the spirit of Ada) > Further even if a pointer is constructed with new, it > can be subject of GC. So? GC does not prevent me from calling U_D or Very_..._Operator. -- Maciej Sobczak http://www.msobczak.com/