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,a78600718149068b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!postnews.google.com!u25g2000pra.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: tagged primitive operation and freezing Date: Mon, 15 Nov 2010 08:30:49 -0800 (PST) Organization: http://groups.google.com Message-ID: <6d5b4fec-ac32-4efe-a9b8-02cbaca625b9@u25g2000pra.googlegroups.com> References: <878w0xr069.fsf@ludovic-brenta.org> <076ebb12-e620-48b7-ab0f-cb90169d91b4@g4g2000prj.googlegroups.com> 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 1289838649 25868 127.0.0.1 (15 Nov 2010 16:30:49 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 15 Nov 2010 16:30:49 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: u25g2000pra.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; .NET4.0C),gzip(gfe) Xref: g2news2.google.com comp.lang.ada:16483 Date: 2010-11-15T08:30:49-08:00 List-Id: On Nov 15, 6:23=A0am, troll wrote: > But only if it is tagged. untagged type, even though frozen, DOES > compile. I think the reason for this is that when a type is frozen, a compiler needs to be able to determine the representation of objects of the type at that point. For a tagged type T, the "representation" of the object includes the tag, which is (in most or all implementations) used to get to a table of subprogram addresses for the primitive operations of the type. This is needed because of dispatching; if somewhere else in the program you call one of those operations on an object of type T'Class, the program will need to look at the tag and then use that to decide what subprogram to call. This table of subprogram addresses is considered part of the representation, and thus the compiler needs to generate it when the type is frozen; therefore, it's a bad thing if the compiler generates this table and then finds out later there's a new primitive operation that didn't make it into the table because the compiler didn't know about it. None of this applies to untagged types, which is why the rule is different. Hope this helps explain things. -- Adam