comp.lang.ada
 help / color / mirror / Atom feed
From: Pawel Kobylarz <kobylarz@wbkst21.mach.uni-karlsruhe.de>
Subject: Re: Can I have an array of variant records?
Date: 1999/04/21
Date: 1999-04-21T00:00:00+00:00	[thread overview]
Message-ID: <371DC9BE.585254A6@wbkst21.mach.uni-karlsruhe.de> (raw)
In-Reply-To: 7fk8c6$mbe$1@nnrp1.dejanews.com

Robert Dewar wrote:

> To expand on my previous short message. Just declare the
> type with a default discriminant. In this case you can
> freely alter the discriminant value later on, and such
> types compose freely (although some old compilers, notably
> the Alsys Ada 83 compiler had rather severe size
> limitations on the composition of such types).
>

How to alter the discriminant? I searched in several different sources of
documentation
and I have not found that.

I declared variant record:

type Tool_Operation(action : Action_Type := Wait) is
  record
    case action is
      when Wait => howlong : time;
      when Move => where : position; min_time : time;
    end case;
  end record;


Let's define variable:

   top : Tool_Operation;


Such a statement compiles and work:

  case top.action is
    when Move =>
        ...
    when Wait =>
        ...
    when others =>
        ...
  end case;


But such statement does not compile:

        top.action := Move;


The compiler returns error: "left hand side of assignment must be a
variable"

How to alter the discriminant?






  parent reply	other threads:[~1999-04-21  0:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-20  0:00 Can I have an array of variant records? Josh Highley
1999-04-20  0:00 ` bglbv
1999-04-21  0:00   ` Robert Dewar
1999-04-21  0:00     ` bglbv
1999-04-22  0:00       ` dennison
1999-04-21  0:00     ` Pawel Kobylarz [this message]
1999-04-21  0:00       ` czgrr
1999-04-21  0:00       ` David C. Hoos, Sr.
1999-04-21  0:00         ` Robert Dewar
1999-04-21  0:00       ` dennison
1999-04-21  0:00         ` Robert Dewar
1999-04-22  0:00           ` Josh Highley
1999-04-23  0:00           ` Pawel Kobylarz
1999-04-21  0:00 ` Robert Dewar
1999-04-22  0:00 ` Maybe not exactly a variant record Josh Highley
1999-04-22  0:00   ` dennison
1999-04-23  0:00     ` Nick Roberts
replies disabled

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