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.99.181.76 with SMTP id u12mr32657613pgo.27.1483372459009; Mon, 02 Jan 2017 07:54:19 -0800 (PST) X-Received: by 10.157.37.151 with SMTP id q23mr2324600ota.4.1483372458966; Mon, 02 Jan 2017 07:54:18 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!b123no5707003itb.0!news-out.google.com!u18ni5397ita.0!nntp.google.com!b123no5706996itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 2 Jan 2017 07:54:18 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=88.207.167.150; posting-account=sDyr7QoAAAA7hiaifqt-gaKY2K7OZ8RQ NNTP-Posting-Host: 88.207.167.150 References: <29380aa7-0c3b-4908-94c6-aa91f3996b42@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <083ed057-76be-4ef1-98af-51a0e94f9b39@googlegroups.com> Subject: Re: Experimenting with the OOP features in Ada From: Laurent Injection-Date: Mon, 02 Jan 2017 15:54:18 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:32998 Date: 2017-01-02T07:54:18-08:00 List-Id: On Monday, 2 January 2017 15:13:12 UTC+1, Brian Drummond wrote: > On Mon, 02 Jan 2017 05:21:49 -0800, Laurent wrote: > > > Hi > > > > Happy new year! > > > > Trying some OOP features in Ada. So not sure if everything is actually > > correct. > > Comments are welcome. > > > > So I have done a little test. Link at the end. > > I get the following error: > > > > raised CONSTRAINT_ERROR : my_strings-handle.adb:14 access check failed > > > > Which I don't understand. Sounds like the object no longer exists? > > > Test_Antibiotic := Base_Types.Antibiotics.Create_Name > (Name => "Test Antibiotic 3"); > Test_Antibiotic := Base_Types.Antibiotics.Create_Code_SIL > (Code_SIL => "gen"); > Test_Antibiotic := Base_Types.Antibiotics.Create_CMI (CMI => "8"); > Test_Antibiotic := Base_Types.Antibiotics.Create_SIR (SIR => "I"); > > Looks like you're creating 4 new Base_Types.Antibiotics.Objects here and > discarding the first three. > > The fourth has whatever the default is for its Name, instead of "Test > Antibiotic 3", whose owner got discarded. > > I suspect you intended something more like > > Test_Antibiotic := Base_Types.Antibiotics.Create_Name (Name => "Test > Antibiotic 3"); > Test_Antibiotic.Set_Code_SIL (Code_SIL => "gen"); > Test_Antibiotic.Set_CMI (CMI => "8"); > Test_Antibiotic.Set_SIR (SIR => "I"); > > or even another call to the all-in-one Create you used initially. > > -- Brian Actually I am just trying to update the different parts of Test_Antibiotic. Create... = Set and Value... = Get But those names are used in the SimpleComponents and its doc so I tried to stick to this naming to not get confused. Which failed The all-in-one Create I would have called Make... Test_Antibiotic.Create_Whatever (Whatever =>...) doesn't work. Those are functions not procedures. Was the first thing which I tried and got me confused too. But the naming shouldn't influence the behaviour, should it?