Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)
From: Alf P. Steinbach (alfps_at_start.no)
Date: 30 Mar 2005 03:33:39 -0500 To: (Usenet)
* Ben Measures:
> Type safety merely mandates that the type of data objects is fixed and
> does not vary over the lifetime of the object. This has nothing to do
> with the concepts emphasized by OOP.
Type safety does not mandate that the type of data objects is fixed.
Smalltalk is a language that provides for type safety mainly via dynamic type
checking (I don't know whether there is static checking in modern Smalltalks).
C++ is a language that provides for type safety in some cases via dynamic type
I think it can be argued that Smalltalk is effectively more type safe than C++
(I also think the opposite can be argued, and then it boils down to what kinds
of type safety one cares about the most in any particular context).
However, I'm not sure that it's Good to single out type safety as what OO is
all about, and say that that is mainly what this tool is for. Rather, I think
a certain ease of providing type safety is a _requirement_ for any successful
OO mechanism, because it's difficult or meaningless to apply abstraction when
any object can be anything, or invalid wrt. the assumed type. C++ is
interesting in this respect because the C++ mechanisms for ensuring type
safety are very pragmatic ones where the difficulties mount exponentially the
stronger your goal of type safety is, and yet it has, in practice, been good
enough that C++ is a very successful language, used for very complex systems.
-- A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail? [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]