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-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!texta.sil.at!newsfeed.inode.at!news.hispeed.ch!linux2.krischik.com!news From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Dynamically tagged expression required Date: Thu, 08 Dec 2005 20:17:18 +0100 Organization: Cablecom Newsserver Message-ID: <2852224.m2vuDFxfOX@linux1.krischik.com> References: NNTP-Posting-Host: 84-73-0-2.dclient.hispeed.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.hispeed.ch 1134070203 29187 84.73.0.2 (8 Dec 2005 19:30:03 GMT) X-Complaints-To: news@hispeed.ch NNTP-Posting-Date: Thu, 8 Dec 2005 19:30:03 +0000 (UTC) User-Agent: KNode/0.9.2 Xref: g2news1.google.com comp.lang.ada:6776 Date: 2005-12-08T20:17:18+01:00 List-Id: Maciej Sobczak wrote: > Hi, > > 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); try: D : Shape'Class := C; as well - it will work as well. > > 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? because it is an initialization. > Why is (3) not allowed? because it is an assignment. Read: http://en.wikibooks.org/wiki/Ada_Programming/Subtypes http://en.wikibooks.org/wiki/Ada_Programming/Object_Orientation Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com