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=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!aioe.org!.POSTED.3d73Ybk3C5U4I2t8lv+lAQ.user.gioia.aioe.org!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: Is this a bug? Date: Fri, 3 Jan 2020 09:37:28 +0100 Organization: Aioe.org NNTP Server Message-ID: References: <1d96e0e1-7700-4947-9fcb-051a1203c703@googlegroups.com> <8bc80421-29fb-4f19-baf0-b14680a99c32@googlegroups.com> NNTP-Posting-Host: 3d73Ybk3C5U4I2t8lv+lAQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.9.2 Xref: reader01.eternal-september.org comp.lang.ada:57787 Date: 2020-01-03T09:37:28+01:00 List-Id: On 2020-01-03 08:35, reinert wrote: > torsdag 2. januar 2020 10.34.17 UTC+1 skrev Dmitry A. Kazakov følgende: >> On 2019-12-31 22:50, Randy Brukardt wrote: >> >>> The best possible fix here would be to find some alternative notation for >>> record components so that there would be a work-around in case the primary >>> notation doesn't work. >> >> A'Component (B) >> >> B of A >> >> etc for A.B. >> >> -- >> Regards, >> Dmitry A. Kazakov >> http://www.dmitry-kazakov.de > > But I kind of like the concept of "extending" the record as illustrated here: > > type rec1_t is tagged record > a : Integer := 2; > b : integer := 2; > end record; > function c(x: rec1_t) return Integer is (x.a + x.b); > rec1 : rec1_t; > > And then rec1.c = 4 is true. > > But what is really the problem of prohibiting to include above: > > function a(x: rec1_t) return Integer is (5); > > ? > > This is similar to that the following is not legal: > > type rec1_t is tagged record > a : Integer := 2; > b : Integer := 2; > a : Integer := 5; -- is not legal. > end record; > > ? Yes, but that is was not possible, because in Ada 95 the function "a" did not conflict with members. The change in Ada 2005 introduced dot notation and thus the conflict. What Randy meant is a different issue that there is no "fully qualified" form to get a record member since Ada 2005 change made "." overloaded. If "." were a first-class operation, then one would have it: "." (X, "a") vs a (X) Such operation could be very difficult to introduce. X'Component (A) or A of X are much simpler. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de