comp.lang.ada
 help / color / mirror / Atom feed
From: Laurent <lutgenl@icloud.com>
Subject: Re: Experimenting with the OOP features in Ada
Date: Tue, 3 Jan 2017 05:43:12 -0800 (PST)
Date: 2017-01-03T05:43:12-08:00	[thread overview]
Message-ID: <452295b5-bd8c-4889-9a0a-a3a9e41357a2@googlegroups.com> (raw)
In-Reply-To: <o4g6il$ba6$1@dont-email.me>

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

  reply	other threads:[~2017-01-03 13:43 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-02 13:21 Experimenting with the OOP features in Ada Laurent
2017-01-02 14:11 ` Brian Drummond
2017-01-02 14:43   ` Brian Drummond
2017-01-02 16:27     ` Laurent
2017-01-03 13:01       ` Brian Drummond
2017-01-03 13:57         ` Laurent
2017-01-03 14:31           ` Dmitry A. Kazakov
2017-01-03 17:07             ` G.B.
2017-01-03 20:42               ` Dmitry A. Kazakov
2017-01-04 12:18             ` Laurent
2017-01-04 12:44               ` Dmitry A. Kazakov
2017-01-05 11:41                 ` Laurent
2017-01-05 13:02                   ` Dmitry A. Kazakov
2017-01-05 13:11                   ` AdaMagica
2017-01-04 15:09               ` Shark8
2017-01-05 11:54                 ` Laurent
     [not found]     ` <85ef59f3-bcbe-4630-9b4d-8285623ab456@googlegroups.com>
2017-01-03 12:48       ` Brian Drummond
2017-01-03 13:43         ` Laurent [this message]
2017-01-02 15:54   ` Laurent
2017-01-02 16:41 ` Dmitry A. Kazakov
2017-01-02 18:50   ` Laurent
2017-01-02 20:55     ` Dmitry A. Kazakov
2017-01-03 13:39       ` Laurent
2017-01-03 14:40         ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox