Type-safe refers to a language's built-in checking for type compatibility. For example Java will not allow assignments of a variable with wider width to a variable with a shallower width. For example, the following Java code fails to compile:
But the following C code does compile:
Type safety goes much further in Java when it comes to reference checking but you get the idea. [ October 16, 2002: Message edited by: Leslie Chaim ]
In fact, there are two forms of type safety: There are weakly versus strongly typed languages. Java and Smalltalk are strongly typed languages - they will give you an error if you try to use an object as an inapropriate type (for example by throwing a ClassCastException). C++ is a weakly typed language - you can cast any object to any type, the program will just try to interpret the bytes at the memory location accordingly (with sometimes devastating results...). Then there are dynamically versus statically typed languages. In statically typed languages like Java and C++, the validity of calling a method is determined at compile time - polymorphism is bound to the inheritance hierarchy. In dynamically typed languages like Smalltalk, method calls are verified at runtime, based solely on method signatures - polymorphism and inheritance are totally orthogonal in these languages. Does that help?
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus