[comp.lang.smalltalk] Class an object?

tanp@latcs1.oz (Tan Poh Lee) (09/08/89)

I like to have some clarification on several questions about class.

1. Is a class an object?

2. Does it have a unique system identifier like the object?

3. Object has a system/object identifier, value and associated methods.
   Is it right to say that a class have system identifier, value domain, 
   methods and a NAME?

4. Is a tuple object which consists of another tuple object (ie. only one
   composition level) regarded as a complex object? 
   An example:
	O1 : <name: 'Tom', age: '25', spouse: O4>
	O4 : <name: 'Mary', age: '23', spouse: O1>
   Is O1 a complex object? 

I am aware some object-oriented languages do not have class concept.
If you have any language in mind with respect to the answers of the
questions above,  please mention it. Thanks.

bertrand@eiffel.UUCP (Bertrand Meyer) (09/10/89)

From article <6319@latcs1.oz> by tanp@latcs1.oz (Tan Poh Lee):
> I like to have some clarification on several questions about class.
> 
> 1. Is a class an object?

Not in Eiffel, but you can create an object representing a class.
If you use the facilities from the Eiffel Support Library, you can obtain
an instance of type E_CLASS by

   class_descriptor := universe.item ("CLASS_NAME")

Here ``universe'', of type UNIVERSE (another library class) is a reference
to the description of a ``universe'', or set of classes. A universe is
obtained on Unix by specifying an arbitrary list of directories;
the universe contains all the classes that reside in any of these
directories.

Once you have obtained ``class_descriptor'' in this way, you can apply to
it all sorts of features to get every possible information about the
class: full class text, abstract text (this is a form showing only
the interface, including assertions), text of individual routines,
list of features and their signatures (or routines only, functions only,
procedures only etc.), parents, ancestors, clients, suppliers etc.
 
> 
> 2. Does it have a unique system identifier like the object?

All the classes in a universe have different names. (When a duplicate
name is found in the process described above for obtaining a universe 
from a list of directories, only the first class of each name is kept.)
Whether the implementation also decides to have a unique identifier for
each class is, in this context, irrelevant to programmers. 

> 
> 3. Object has a system/object identifier, value and associated methods.
>    Is it right to say that a class have system identifier, value domain, 
>    methods and a NAME?

Sorry, I don't understand (beyond the answers given above).

> 4. Is a tuple object which consists of another tuple object (ie. only one
>    composition level) regarded as a complex object? 
>    An example:
> 	O1 : <name: 'Tom', age: '25', spouse: O4>
> 	O4 : <name: 'Mary', age: '23', spouse: O1>
>    Is O1 a complex object? 

The current version of Eiffel includes a notion of expanded types and
composite objects. Then if I understand the question properly the
answer is yes in eiffel.

> I am aware some object-oriented languages do not have class concept.

An object-oriented language without a notion of class seems to me like
a meal without cheese (``Un repas sans fromage est comme une belle a qui
il manque un oeil'', Brillat-Savarin, quoted by Flaubert in Le
Dictionnaire des Idees recues).

> If you have any language in mind with respect to the answers of the
> questions above,  please mention it. Thanks.

Eiffel.

For any more information see the book ``Eiffel: The Language''
(also known as the Eiffel Reference Manual), recently announced
on comp.lang.eiffel.

-- Bertrand Meyer
bertrand@eiffel.com