> what exactly is code being type safe??
http://en.wikipedia.org/wiki/Type_safety
The terms below are explained in slightly more detail in ECMA
Specification 335, 3rd edition.
> a.. A reference to a type is strictly compatible with the type being
> referenced.
One of the things this implies is that invalid typecasts aren't
possible. In other words, one cannot create a reference to a type which
doesn't match the actual type of the object. For example:
object o = new object();
string s = (string) o;
This code won't work at runtime. If a variable or field is declared of
type X, then the value being referred to is compatible with type X. In a
language like C++, one could write this:
Object* o = new Object;
String* s = (String*) o;
... and it would succeed without any runtime errors.
> b.. Only appropriately defined operations are invoked on an object.
This means that you can only call methods that are declared on the type.
For example:
object o = new object();
o.Substring(1);
This is calling the System.String::Substring(int) method on an object.
Object doesn't have this method, so it is invalid.
> c.. Identities are what they claim to be.
This basically means that objects can't be spoofed.
For example, given the following C++:
String* s = new String;
unsigned char *buf = (unsigned char *) s;
Here, buf can be used to arbitrarily modify internal fields and the
vtable of the String class. Verifiable code can't do this.
-- Barry

Signature
http://barrkel.blogspot.com/