From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,48bf593f723b7524 X-Google-Attributes: gid103376,public From: Pawel Kobylarz Subject: Re: Can I have an array of variant records? Date: 1999/04/21 Message-ID: <371DC9BE.585254A6@wbkst21.mach.uni-karlsruhe.de>#1/1 X-Deja-AN: 469115394 Content-Transfer-Encoding: 7bit References: <371c84fb.0@silver.truman.edu> <87aew3j899.fsf@bglbv.my-dejanews.com> <7fk8c6$mbe$1@nnrp1.dejanews.com> Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@rz.uni-karlsruhe.de X-Trace: news.rz.uni-karlsruhe.de 924699071 22369 129.13.175.21 Organization: University of Karlsruhe Mime-Version: 1.0 Reply-To: kobylarz@wbkst21.mach.uni-karlsruhe.de Newsgroups: comp.lang.ada Date: 1999-04-21T00:00:00+00:00 List-Id: 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?