comp.lang.ada
 help / color / mirror / Atom feed
From: gautier_niouzes@hotmail.com
Subject: Re: derived formal types and known discriminants
Date: Mon, 3 Jul 2017 18:36:20 -0700 (PDT)
Date: 2017-07-03T18:36:20-07:00	[thread overview]
Message-ID: <fe8c975d-9e62-4292-950e-34e15930931f@googlegroups.com> (raw)
In-Reply-To: <a1bd4695-00ff-49a8-a07a-84ebdb043202@googlegroups.com>

"construction for an abstract parent type": just a wild guess: you would perhaps do something like this:

  type T is abstract tagged record
    i: Integer:= 1;
  end record;

  procedure Reset (x: in out T) is
    fresh_new: T;   --  GNAT: type of object cannot be abstract
  begin
    x:= fresh_new;  --  GNAT: target of assignment operation must not be abstract
  end;

...and you are blocked at the lines with comments.
Then a solution is a non-abstract grand-parent type:

  type Pre_T is tagged record
    i: Integer:= 1;
  end record;

  type T is abstract new Pre_T with null record;

  procedure Reset (x: in out T) is
    fresh_new: Pre_T;
  begin
    Pre_T(x):= fresh_new;
  end;

HTH...
_____________________________________________________________
A free online game in Ada: http://pasta.phyrama.com/game.html

  reply	other threads:[~2017-07-04  1:36 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-23  0:45 derived formal types and known discriminants sbelmont700
2017-06-23 17:26 ` Randy Brukardt
2017-06-29 14:15   ` sbelmont700
2017-06-29 14:39     ` Dmitry A. Kazakov
2017-06-29 17:40       ` Robert Eachus
2017-06-30  1:10     ` Randy Brukardt
2017-06-30  7:24       ` Dmitry A. Kazakov
2017-06-30 18:09         ` Randy Brukardt
2017-07-04  0:30           ` sbelmont700
2017-07-04  1:36             ` gautier_niouzes [this message]
2017-07-04  2:29             ` Randy Brukardt
2017-07-04  7:09             ` Dmitry A. Kazakov
2017-07-04 17:34               ` Shark8
2017-07-03 17:24 ` Jere
replies disabled

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