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,c08a7609345f4e5 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news1.google.com!news1.google.com!postnews.google.com!c10g2000yqh.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Limited use for limited with? Date: Fri, 8 Oct 2010 01:05:36 -0700 (PDT) Organization: http://groups.google.com Message-ID: <37e167dc-1741-4627-bef4-1fd8b32bdbeb@c10g2000yqh.googlegroups.com> References: <853314bc-0f79-435f-86a5-d7bcdd610731@c10g2000yqh.googlegroups.com> <36e886fa-b272-461f-bf86-a6b18366b64f@i5g2000yqe.googlegroups.com> <1eug9v5h5mf8d$.ud00hrz48lyr.dlg@40tude.net> <67044906-dacc-4526-b3f6-27e5323ab8fc@n3g2000yqb.googlegroups.com> <12chb4kbqt9ln$.zumsv1z9hqvk$.dlg@40tude.net> <292dd0bd-1fc4-4715-bb70-7655d0dc04eb@j24g2000yqa.googlegroups.com> <1ffdzc3fkapks$.15g452pvvgrem$.dlg@40tude.net> NNTP-Posting-Host: 77.254.189.90 Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1286564606 14795 127.0.0.1 (8 Oct 2010 19:03:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 8 Oct 2010 19:03:26 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: c10g2000yqh.googlegroups.com; posting-host=77.254.189.90; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:14443 Date: 2010-10-08T01:05:36-07:00 List-Id: On 5 Pa=C5=BA, 09:35, "Randy Brukardt" wrote: > > Not at all. In my design Object knows nothing about registry. There is > > no such dependency and therefore it does not have to be broken. > > But the Registries are completely unsafe! They have no way to protect > against dangling pointers, That's right. The problem is that none of the proposed solutions is adequate here, for reasons that I have explained already. My point is that this is one of those places where using plain pointers is the best solution, even taking into account all its potential problems. Important note: in my design dangling pointers are prevented not by registry or its obscure API, but by the purpose of the whole. In 100% cases that are known to me the objects outlive the registry, so there is no possibility to create dangling pointers. Granted, users *can* write an artificial and nonsense code (perhaps to prove the point) that will create dangling pointers, but no amount of protection will prevent such intentional misuse. Note that even now creating a dangling pointer requires explicit use of 'Unchecked_Access. No matter what you do, you cannot protect the user against him using Unchecked_XXX tools, which will always make all your protections useless, no matter how sophisticated. In short: you can protect against Murphy, but not against Machiavelli. > It's always better to prevent abuse in the interface. Unless the "protection" makes the system unusable. Clarity and ease of use are important goals, too. Ironically, they even promote correctness. -- Maciej Sobczak * http://www.inspirel.com