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: a07f3367d7,c05bdbf8e48c4dfa X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!u3g2000prl.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Generic operation and prefixed notation Date: Mon, 14 Jun 2010 18:14:58 -0700 (PDT) Organization: http://groups.google.com Message-ID: <6e7f218f-5a4a-4437-8bdb-7000937f01e1@u3g2000prl.googlegroups.com> References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1276564498 17991 127.0.0.1 (15 Jun 2010 01:14:58 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 15 Jun 2010 01:14:58 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: u3g2000prl.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:11739 Date: 2010-06-14T18:14:58-07:00 List-Id: On Jun 14, 11:11=A0am, Yannick Duch=EAne (Hibou57) wrote: > Le Mon, 14 Jun 2010 19:47:09 +0200, Marek Janukowicz =A0 > a =E9crit: > > Hi Marek, > > > Given a simplified example: > > > =A0 type Model is tagged record > > =A0 =A0 null > > =A0 end record; > > > =A0 generic > > =A0 =A0 Attr_Name : String; > > =A0 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 th= e =A0 > dotted notation. > > For a subprogram to be a primitive, it must be declared in the same =A0 > package as the one which declares the type (here Modem). That is OK here = =A0 > for that. However, it also additionally requires the type is not frozen. = =A0 > Here, when you define a generic using a Model as an argument, I'm pretty = =A0 > sure this makes Model frozen. > > Basically, a type is made frozen as soon as some reference to it requires= =A0 > some important stuff are already defined. When you make some kind of =A0 > reference to a type, it suppose the type is frozen, that is, all these = =A0 > important stuff are already defined. Actually, I'm not sure that the generic declaration freezes Model. The problem here is that the generic requires a body, and if you try to instantiate it before the body is seen, you'd get a Program_Error. But if you put the body of Get_Attribute before the instantiation (assuming this isn't in a package spec), then *that* would cause Model to be frozen. I can't really tell whether the operation is legal or primitive, however, or what kind of freezing has taken place, because the code isn't a complete example. I don't know whether the declarations are in a package spec, a package body, the declarative part of a procedure, or just taken out of context from various parts of the program. -- Adam