Tracking the type is crucial for allocating the proper
registers / values and running the proper operators.
This tracks the types you declared, not the types of the values
actually used.
The artificial distinction you are making here between the declared
and "actual" type doesn't make any sense as long as we talk about C
based languages.
The distinction is not at all artificial.
C and its descendants are statically typed languages. They don't
have the concept of a dynamic type.
While statically typed, they are not strongly typed but weakly typed
(due to casts). You absolutely *can* have a value that does not
agree with its static type, though you have no way of determining
this type mismatch other than that the value will not work for you.
For example:
float a=3.14159;
float *b=&a;
int **c=(int**)b;
int d = **c;
This will probably segfault on you quite badly, because you are using
the in-memory bit pattern of the float 3.14159 as a pointer.
Another example closer to home:
typedef struct {
Class isa;
int a;
} _MyObject;
typedef struct {
Class isa;
float a;
} _AnotherObject;
_MyObject a = { objc_getClass( "MyObject" ), 1 };
_AnotherObject b = { objc_getClass( "AnotherObject" ), 2.0 };
Are you going to argue that this is NOT a case where the dynamic type
of the "object" disagrees with the static type?
[snip]
Marcel
--
Marcel Weiher Metaobject Software Technologies
email@hidden www.metaobject.com
Metaprogramming for the Graphic Arts. HOM, IDEAs, MetaAd etc.
1d480c25f397c4786386135f8e8938e4
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden