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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.36.127.135 with SMTP id r129mr3235569itc.48.1520798822429; Sun, 11 Mar 2018 13:07:02 -0700 (PDT) X-Received: by 10.157.3.237 with SMTP id f100mr326771otf.6.1520798822293; Sun, 11 Mar 2018 13:07:02 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!border1.nntp.ams1.giganews.com!nntp.giganews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!r195no1039207itc.0!news-out.google.com!a2-v6ni3441ite.0!nntp.google.com!r195no1039206itc.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sun, 11 Mar 2018 13:07:02 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.71.218.250; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 173.71.218.250 References: <4ab69a18-5766-446c-85c2-14e094199c95@googlegroups.com> <6792fcd7-a25a-417c-b45a-1a17b0168234@googlegroups.com> <5c448ce7-5646-45c5-b221-3d9c884c4d52@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <59ca25c1-ca05-4ec3-be4c-7b228ee57415@googlegroups.com> Subject: Re: Ada Alternatives to Unrestricted_Access From: Jere Injection-Date: Sun, 11 Mar 2018 20:07:02 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 3404 X-Received-Body-CRC: 1397099077 Xref: reader02.eternal-september.org comp.lang.ada:50933 Date: 2018-03-11T13:07:02-07:00 List-Id: On Sunday, March 11, 2018 at 2:27:08 PM UTC-4, Niklas Holsti wrote: > On 18-03-11 19:33 , Jere wrote: > > The problem I run into with this provided code base, is that it > > often iterates over a constant view of the container. > > One way to modify the semantic state of an object, through a constant > view of the object, is to provide the object with a component that is an > access to another object that contains the state you want to modify. > > For example, to implement the tamper check, the container could have an > "access Boolean" component where the Boolean is the flag that enables > the tamper checks (or perhaps it should be a Natural, to handle nested > iterations). > > Or you could use the "Rosen trick", with a container component that is > an access (variable view) to the container itself. If I was allowed to redesign the code, I would definitely approach it differently than the original author. I'm not allowed to overhaul the existing code outside of very simple changes that don't impact any specs or runtime behavior. In this case, the specific request was can I modify the code easily to avoid using the GNAT extension. If not, then the owner would rather leave it as is. I was trying to verify that changing Container'Unrestricted_Acess to A2A.To_Pointer(Container'Address) was legit/legal/ok/etc. I was a little concerned it could invoke erroneous behavior (in a general language sense) if the ARM allowed for different object representations for constant vs non-constant variables. At some point, I think both Dmitry and Jeff came under the assumption that either I was writing this all from scratch or I was adding iteration to something that didn't already have it (neither of which is true). I'm not even the original author. On the Rosen Trick: Can you do that for non-limited types? Most of the containers are not limited.