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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c05bdbf8e48c4dfa X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder.news-service.com!news.k-dsl.de!aioe.org!not-for-mail From: =?iso-8859-15?Q?Yannick_Duch=EAne_=28Hibou57=29?= Newsgroups: comp.lang.ada Subject: Re: Generic operation and prefixed notation Date: Mon, 14 Jun 2010 20:11:13 +0200 Organization: Ada At Home Message-ID: References: NNTP-Posting-Host: sJrrJ5Dd+Q0y1fuLaSELkQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes Content-Transfer-Encoding: Quoted-Printable X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 User-Agent: Opera Mail/10.53 (Win32) Xref: g2news1.google.com comp.lang.ada:11718 Date: 2010-06-14T20:11:13+02:00 List-Id: Le Mon, 14 Jun 2010 19:47:09 +0200, Marek Janukowicz = a =E9crit: Hi Marek, > Given a simplified example: > > type Model is tagged record > null > end record; > > generic > Attr_Name : String; > procedure Get_Attribute( M : Model ); Here, Get_Attribute is not a primitive operation of Model I suppose. If it is not a primitive operation of Model, you cannot invok it using t= he = dotted notation. For a subprogram to be a primitive, it must be declared in the same = package as the one which declares the type (here Modem). That is OK here= = for that. However, it also additionally requires the type is not frozen.= = Here, when you define a generic using a Model as an argument, I'm pretty= = sure this makes Model frozen. Basically, a type is made frozen as soon as some reference to it require= s = some important stuff are already defined. When you make some kind of = reference to a type, it suppose the type is frozen, that is, all these = important stuff are already defined. Hint (as kind of personal opinion): I prefer to restrict to dotted = notation to access record fields in implementation, and just use the = classic subprogram invocation even with tagged. However, this is not = always handy with inherited operation. -- = There is even better than a pragma Assert: a SPARK --# check. --# check C and WhoKnowWhat and YouKnowWho; --# assert Ada; -- i.e. forget about previous premises which leads to conclusion -- and start with new conclusion as premise.