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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,154942e4f1d1b8e9 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!news.belwue.de!newsfeed.arcor.de!news.arcor.de!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Dynamically tagged expression required Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.14.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: Date: Thu, 8 Dec 2005 15:52:06 +0100 Message-ID: <19rt1tv1y2lu0$.1j7v8bh48fwby.dlg@40tude.net> NNTP-Posting-Date: 08 Dec 2005 15:52:06 MET NNTP-Posting-Host: 67f71497.newsread4.arcor-online.net X-Trace: DXC=I@@<=7181MT>K]\3>m]<[U:ejgIfPPldTjW\KbG]kaMXFYk:AnJB[C]TE>5;?1=4k^[6LHn;2LCV^7enW;^6ZC`T<=9bOTW=MN^ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:6769 Date: 2005-12-08T15:52:06+01:00 List-Id: On Thu, 08 Dec 2005 14:50:37 +0100, Maciej Sobczak wrote: > procedure Hello is > > type Shape is tagged null record; > type Triangle is new Shape with > record > SideLen : Positive; > end record; > > A : Shape; > B : Shape'Class := A; -- (1) > C : Triangle := (SideLen => 7); > > begin > > A := C; -- (2) > B := C; -- (3) > > end Hello; > > (2) does not compile, and this is what was expected. > (3) does not compile, neither, beucase "dynamically tagged expression > required". > > Interestingly, (1) is fine. > > Why is (1) allowed? It is not an assignment, but initialization. > Why is (3) not allowed? B := B; -- Legal B := Shape'Class (A); -- Legal B := Shape'Class (C); -- Legal, but raises Constraint_Error You cannot change the tag of a class-wide object, so it would have little sense anyway. However if ":=" were considered as a dispatching operation, then (3) should be made legal. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de