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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Experimenting with the OOP features in Ada Date: Tue, 3 Jan 2017 12:48:21 -0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <29380aa7-0c3b-4908-94c6-aa91f3996b42@googlegroups.com> <85ef59f3-bcbe-4630-9b4d-8285623ab456@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 3 Jan 2017 12:48:21 -0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="a12737357a658730bd7499ca260b1af3"; logging-data="11590"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cYLVyMF4O90gj1X0Cxw+pv82cCzTMTD4=" User-Agent: Pan/0.140 (Chocolate Salty Balls; GIT b8fc14e git.gnome.org/git/pan2) Cancel-Lock: sha1:aEpzLgMjK/wzpr+aL4KQBHdAonA= Xref: news.eternal-september.org comp.lang.ada:33016 Date: 2017-01-03T12:48:21+00:00 List-Id: 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