Newsgroups: comp.object,comp.lang.smalltalk,comp.lang.c++,comp.lang.misc
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!news.kei.com!newsfeed.internetmci.com!in1.uu.net!mdisea!mothost!schbbs!news
From: shang@corp.mot.com (David L. Shang)
Subject: Re: Types, types: static vs. dynamic -- classification
Reply-To: shang@corp.mot.com
Organization: MOTOROLA 
Date: Wed, 29 Nov 1995 16:47:14 GMT
Message-ID: <1995Nov29.164714.3724@schbbs.mot.com>
References: <49gge1$m3j@news.ox.ac.uk>
Sender: news@schbbs.mot.com (SCHBBS News Account)
Nntp-Posting-Host: 129.188.128.126
Lines: 63
Xref: glinda.oz.cs.cmu.edu comp.object:41612 comp.lang.smalltalk:31242 comp.lang.c++:162452 comp.lang.misc:24020


> In article <1995Nov28.153028.20561@schbbs.mot.com>,
> David L. Shang <shang@corp.mot.com> wrote:
> >I don't like the idea to treat "tags" as a part of the object.
>
 
In article <49gge1$m3j@news.ox.ac.uk> lady0065@sable.ox.ac.uk
(David Hopwood) writes:
> Why not? Consider:
> 
> (1, 2) -- ordered pair of integers
> 1+2i   -- gaussian integer
> 1/2    -- rational
> 
> These may well have the same representation, excluding any run-time
> tag. But are they the same object? Certainly not.

They are not the same object but are not necessary to be tagged
because they are constant expression and we know the exact type
of the object.

Tag is required only when we try to attach them to a polymophic
variable. For example:

	x: number; // x is a polymorphic variable

	x := 1/2;  // x is tagged with rational;
	x := 1+2i;  // x is tagged with gaussian integer

It is not the object is taged, but the variable is tagged.

Is there any case that an object is required to be tagged? Yes.
When the object must be transferred to/from a foreign system
(network, database, object defined in other language environment).
Specific tag protocol must be used for each different foreign
system. In this case, I would like to have a wrap system that
package an object to a tagged object, which is a composite
object containing the type spefication of the object and the 
value of the object.

But objects should not be tagged INTRINSICALLY.

> 
> By convention a variable is said to contain a value, not a
> (tag, value) pair (no matter how it happens to be implemented).
> 

This is not the convention for polymorphic variables defined
in all languages.

> >C++ uses a tag as a part of the object. As a result, C++ cannot
> >separate the tags from object codes. That is why C++ cannot
> >provide a complete type info for all types.
> 
> This is completely wrong. A Smalltalk object specifies its tag -
> do you claim that Smalltalk does not provide 'complete type info'?
> 

If C++ does not care about the tag overhead to all primitive
objects, then I am wrong.


David Shang
