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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,2dae9e735b6ea318 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-26 14:38:34 PST From: whraven@usenet-access.com (Richard Pinkall-Pollei) Newsgroups: comp.lang.ada Subject: Re: record question References: <3BD9618C.D154FE0C@icn.siemens.de> Message-ID: User-Agent: slrn/0.9.6.4 (Linux) NNTP-Posting-Host: 127.0.0.1 Date: 26 Oct 2001 16:22:49 -0500 X-Authenticated-User: 5591045 X-Comments: This message was posted through Binaries.net X-Comments2: IMPORTANT: Binaries.net does not condone, nor support, spam or any illegal or copyrighted postings. X-Report: Please report abuse to Organization: Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!feed1.uncensored-news.com!propagator-la!news-in-la.newsfeeds.com!corp-goliath.newsgroups.com Xref: archiver1.google.com comp.lang.ada:15281 Date: 2001-10-26T16:22:49-05:00 List-Id: >assume that I have a record like the one below. I can assign aggregates >in the case that I have subcomponents, but how do I assign if I don't >have? > > [code example moved to end of message for reference] The record type you are using is "mutable", since it has a default discriminant. Thus, you can change the discriminant, but only if you provide a complete record or aggregate in the assignment. Thus, you would have to use "y := ( i => 99 ) ;" since it assigns a complete aggregate (since "i" is the only component for this discriminant value). You cannot use the "y.i" form, since that would technically only assign a single component, even though the record has only one component. I ran your code fragment through the GNAT 3.13p compiler, just to see if it was smart enough to realize that "y.i" was, in fact, the only record component. The error message resulting from the "y.i" assignment states that the left hand of the assignment must be a variable. I would say that's not the real problem, but I'm not sure why GNAT flags it this way. >procedure RT is > type x (i : Integer := 0) is > record > case i is > when 0 => null; > when 1..10 => s : STRING (1..10); > when others => null; > end case; > end record; > > y : x; >begin > y := (1, "ABC "); -- this is OK > > y := (99); -- but, how do that ? > > y.i := 99; -- do not work either, so how assign a value different to >1..10 ? >end RT; -- ______________________________________________________________________________ Posted Via Binaries.net = SPEED+RETENTION+COMPLETION = http://www.binaries.net