comp.lang.ada
 help / color / mirror / Atom feed
From: "Nick Roberts" <Nick.Roberts@dial.pipex.com>
Subject: Re: ObjectAda vs Gnat -- bugs
Date: 1997/05/20
Date: 1997-05-20T00:00:00+00:00	[thread overview]
Message-ID: <01bc656a$a0307400$LocalHost@xhv46.dial.pipex.com> (raw)
In-Reply-To: JSA.97May19145513@alexandria




Jon S Anthony <jsa@alexandria> wrote in article
<JSA.97May19145513@alexandria>...
> In article <5loibn$qek@lotho.delphi.com> tmoran@bix.com writes:
> 
> > So if I wanted to make some reusable object with the characteristics:
> >   constant once created
> >   creation requires info not conveniently done with discriminants
> >   limited
> > one approach would be to make the type T limited and tell users to
declare
> >   X : T renames Create(...);
> > Right?
> 
> Works for me...
> 


No, I don't agree. I think the "renames" is potentially misleading. An
alternative approach would be:

      X: T; -- X initialised to an unusable status
   begin
      Init(X,...); -- X now set up as required

The first parameter of procedure X would be of type "in out T". This may be
uglier than the above solution, but it would be less misleading, and it
might be more flexible in some situations (as arbitrary processing can
precede the call to Init). Any attempt to use X before it had been properly
set up could be detected and raise an exception. If X needs to be constant
once set up, any attempt to call Init again on X could also be detected and
raise and exception.

Nick.





  parent reply	other threads:[~1997-05-20  0:00 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-19  0:00 ObjectAda vs Gnat -- bugs tmoran
1997-05-19  0:00 ` Jon S Anthony
1997-05-20  0:00   ` Jeff Carter
1997-05-20  0:00   ` Nick Roberts [this message]
1997-05-25  0:00     ` Tom Moran
  -- strict thread matches above, loose matches on Subject: below --
1997-05-30  0:00 John Walker
1997-05-16  0:00 Keith Thompson
1997-05-16  0:00 ` Robert A Duff
1997-05-16  0:00   ` Robert Dewar
1997-05-18  0:00     ` Nick Roberts
1997-05-19  0:00       ` Robert Dewar
1997-05-20  0:00         ` Nick Roberts
1997-05-21  0:00           ` Robert Dewar
1997-05-23  0:00   ` Stephen Leake
1997-05-24  0:00     ` Robert A Duff
1997-05-28  0:00       ` Stephen Leake
1997-05-30  0:00         ` Robert A Duff
1997-05-30  0:00           ` Matthew Heaney
1997-05-31  0:00             ` Robert A Duff
1997-05-30  0:00         ` Samuel Mize
1997-05-15  0:00 granger
1997-05-15  0:00 ` Stephen Leake
1997-05-16  0:00   ` Tucker Taft
1997-05-16  0:00     ` Jon S Anthony
1997-05-16  0:00       ` Tom Moran
1997-05-16  0:00       ` Robert Dewar
1997-05-17  0:00         ` Jon S Anthony
1997-05-16  0:00   ` Jon S Anthony
1997-05-15  0:00 ` Robert Dewar
1997-05-16  0:00   ` David L Brown
1997-05-16  0:00     ` Robert Dewar
1997-05-17  0:00       ` Tom Moran
1997-05-18  0:00         ` Jon S Anthony
1997-05-19  0:00         ` Tucker Taft
1997-05-19  0:00       ` Tom Moran
1997-05-15  0:00 ` Samuel A. Mize
1997-05-15  0:00 ` Samuel A. Mize
1997-05-16  0:00 ` Robert A Duff
1997-05-16  0:00   ` Robert Dewar
replies disabled

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