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.159.39.225 with SMTP id b88mr28718741uab.27.1483450992992; Tue, 03 Jan 2017 05:43:12 -0800 (PST) X-Received: by 10.157.11.142 with SMTP id 14mr2591907oth.20.1483450992947; Tue, 03 Jan 2017 05:43:12 -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!1.eu.feeder.erje.net!feeder.erje.net!2.us.feeder.erje.net!newspeer1.nac.net!border2.nntp.dca1.giganews.com!nntp.giganews.com!p16no3570124qta.1!news-out.google.com!g131ni16527itg.0!nntp.google.com!b123no5963063itb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 3 Jan 2017 05:43:12 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=194.154.216.95; posting-account=sDyr7QoAAAA7hiaifqt-gaKY2K7OZ8RQ NNTP-Posting-Host: 194.154.216.95 References: <29380aa7-0c3b-4908-94c6-aa91f3996b42@googlegroups.com> <85ef59f3-bcbe-4630-9b4d-8285623ab456@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <452295b5-bd8c-4889-9a0a-a3a9e41357a2@googlegroups.com> Subject: Re: Experimenting with the OOP features in Ada From: Laurent Injection-Date: Tue, 03 Jan 2017 13:43:12 +0000 Content-Type: text/plain; charset=UTF-8 Xref: news.eternal-september.org comp.lang.ada:33019 Date: 2017-01-03T05:43:12-08:00 List-Id: On Tuesday, 3 January 2017 13:49:53 UTC+1, Brian Drummond wrote: > On Mon, 02 Jan 2017 08:05:18 -0800, Laurent wrote: > > > On Monday, 2 January 2017 15:44:57 UTC+1, Brian Drummond wrote: > > > > >> Test_Antibiotic := Base_Types.Antibiotics.Create_Code_SIL ( > >> This => Test_Antibiotic, Code_SIL => "Test > >> Antibiotic 3") > >> > >> Test_Antibiotic := Test_Antibiotic.Create_Code_SIL > >> (Code_SIL => "Test Antibiotic 3"); > >> > >> but the preferred form would be > >> > >> Test_Antibiotic.Set_Code_SIL (Code_SIL => "gen"); > >> > >> -- Brian > >> > > > > Probably your versions does what I couldn't figure out. I declared Item > > inside the function not as parameter. > > But would that cause a constraint error? > > > > If you try to access "Name" of an object that was created without a > "Name", yes it would. > > I didn't dig deep enough into your constructors to see if that was > genuinely the case or if they were created with some default, but the > constraint error was clear enough evidence for me. I find Ada very good > at catching mistakes early instead of burying them in non-obvious > behaviour. > > -- Brian > Yes transforming the functions to procedure solved this. No more constructors for the components. Just one for the Object itself. Thanks