From: Robert A Duff <bobduff@world.std.com>
Subject: Re: Pb with use of redefined "=" operator
Date: 1998/11/10
Date: 1998-11-10T00:00:00+00:00 [thread overview]
Message-ID: <wccww538aho.fsf@world.std.com> (raw)
In-Reply-To: 729rod$nlv$1@nnrp1.dejanews.com
dennison@telepath.com writes:
> My understanding was that without 'Class, the tag may not even be *present*
> in the object. It isn't really needed, since every object's type is
> determinable at compile time.
But when the compiler lays out objects of the type it needs to decide
whether to include a tag field. It doesn't know if some other part of
the program will mention 'Class (unless it has global knowledge, eg by
deferring all code generation to link time).
Consider:
package P is
type T1 is tagged null record;
X: T1;
procedure Do_Something(X: T1);
procedure Do_Something_Else(X: T1);
end P;
with P; use P;
package Q is
type T2 is new T1 with null record;
Y: T2;
procedure Do_Something_Else(X: T2);
end Q;
with P; use P;
with Q; use Q;
procedure Main is
begin
Do_Something(P.X);
Do_Something(Q.Y);
end Main;
package body P is
procedure Do_Something(X: T1) is
begin
Do_Something_Else(T1'Class(X)); <<--------------------
end Do_Something;
procedure Do_Something_Else(X: T1) is
begin
...
end Do_Something_Else;
end P;
In the usual implementation model, both variables X and Y need a tag
field, but we haven't yet seen any 'Class when they are compiled. An
alternative is to store tags with parameters and pointers, instead of
with the objects themselves. I don't know of any compilers that do
that, and I'm not sure it's a good idea -- it seems kind of annoying to
double the size of all access-to-classwide types.
- Bob
--
Change robert to bob to get my real email address. Sorry.
prev parent reply other threads:[~1998-11-10 0:00 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-11-03 0:00 Pb with use of redefined "=" operator Fran�oise & Herv� BITTEUR
1998-11-04 0:00 ` dewarr
1998-11-04 0:00 ` Tucker Taft
1998-11-04 0:00 ` Mats Weber
1998-11-04 0:00 ` Fran�oise & Herv� BITTEUR
1998-11-04 0:00 ` Matthew Heaney
1998-11-04 0:00 ` Mats Weber
1998-11-05 0:00 ` Matthew Heaney
1998-11-05 0:00 ` Mats Weber
1998-11-05 0:00 ` Matthew Heaney
1998-11-09 0:00 ` Robert A Duff
1998-11-09 0:00 ` Brian Rogoff
1998-11-10 0:00 ` Robert A Duff
1998-11-10 0:00 ` Robert I. Eachus
1998-11-05 0:00 ` dewarr
1998-11-05 0:00 ` Matthew Heaney
1998-11-06 0:00 ` dewarr
1998-11-09 0:00 ` Robert A Duff
1998-11-10 0:00 ` dennison
1998-11-10 0:00 ` Robert A Duff [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox