comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: tagged primitive operation and freezing
Date: Mon, 15 Nov 2010 08:30:49 -0800 (PST)
Date: 2010-11-15T08:30:49-08:00	[thread overview]
Message-ID: <6d5b4fec-ac32-4efe-a9b8-02cbaca625b9@u25g2000pra.googlegroups.com> (raw)
In-Reply-To: 076ebb12-e620-48b7-ab0f-cb90169d91b4@g4g2000prj.googlegroups.com

On Nov 15, 6:23 am, troll <wisniewski...@gmail.com> 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



  reply	other threads:[~2010-11-15 16:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-13  3:24 tagged primitive operation and freezing troll
2010-11-13 10:24 ` Ludovic Brenta
2010-11-15 14:23   ` troll
2010-11-15 16:30     ` Adam Beneschan [this message]
2010-11-16  8:53       ` Ludovic Brenta
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox