comp.lang.ada
 help / color / mirror / Atom feed
From: "Alex Xela" <xela2@free.fr>
Subject: Re: Question on controlled types
Date: Thu, 2 Oct 2003 09:09:20 +0200
Date: 2003-10-02T09:05:54+02:00	[thread overview]
Message-ID: <3f7bce52$0$2777$626a54ce@news.free.fr> (raw)
In-Reply-To: u8yo4imig.fsf@earthlink.net

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1761 bytes --]

Thanks, it is what I was expecting (where did you find the answer, in the
RM95?).

The example below is trying to synthesize your answer:



--------------------------------------------------
with Ada.Finalization;
package Instrum is
    type Instrum_Type is new Ada.Finalization.Controlled with
    record
        A : Integer;
    end record;
    procedure Finalize  (O : in out Instrum_Type);
    procedure Adjust  (O : in out Instrum_Type);
    procedure Initialize  (O : in out Instrum_Type);
    J : Instrum.Instrum_Type := ( Ada.Finalization.Controlled with
A=>0);--nothing : OK
    --J : Instrum.Instrum_Type; --raised PROGRAM_ERROR : access before
elaboration : OK
end Instrum;
--------------------------------------------------
with Instrum, Ada.Finalization,Ada.Text_Io;
procedure Test_Instrum is
    I : Instrum.Instrum_Type := Instrum.J; --adjust : OK
    --I : Instrum.Instrum_Type := ( ada.finalization.controlled with
A=>0); --nothing : OK
    --I : Instrum.Instrum_Type; --initialize : OK
begin
    Ada.Text_Io.Put_line("end;");
end Test_Instrum;


"Matthew Heaney" <matthewjheaney@earthlink.net> a �crit dans le message de
news: u8yo4imig.fsf@earthlink.net...
> "Alex Xela" <xela2@free.fr> writes:
>
> > On the following code, what should happen during J variable elaboration?
> >
> >  - Nothing
> >
> >  - A call to Adjust.
> >
> > I tried to find the answer in RM95 but in vain.
> >
> > My tests on several compilers (and my feeling) were suggesting  :
nothing!
>
> Aggregate assignment is handled specially.  For a controlled type, it
> means the object must be built in place.
>
> Clearly, no controlled operations can be called, because they haven't
> been elaboratated yet.  Hence the special rule for aggregate assignment.
>
>
>
>





  reply	other threads:[~2003-10-02  7:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-01 19:06 Question on controlled types Alex Xela
2003-10-01 23:07 ` Matthew Heaney
2003-10-02  7:09   ` Alex Xela [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-10-01 20:03 Beard, Frank Randolph CIV
2003-10-02 18:45 ` Robert I. Eachus
2003-10-02  8:05 christoph.grein
2009-05-30 11:41 Question on Controlled types Olivier Scalbert
2009-05-30 13:27 ` Dmitry A. Kazakov
2009-05-30 14:16   ` Olivier Scalbert
2009-05-30 14:48     ` Olivier Scalbert
2009-05-30 15:20       ` Robert A Duff
2009-05-30 15:40         ` Olivier Scalbert
2009-05-30 18:37           ` Robert A Duff
2009-06-04 12:32   ` Hibou57 (Yannick Duchêne)
2009-06-04 14:04     ` Dmitry A. Kazakov
2009-06-04 14:34       ` Hibou57 (Yannick Duchêne)
2009-06-04 15:03         ` Dmitry A. Kazakov
2009-06-04 15:13           ` Hibou57 (Yannick Duchêne)
2009-06-06  1:31       ` Randy Brukardt
2009-05-30 13:30 ` christoph.grein
replies disabled

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