Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)

From: Alf P. Steinbach (alfps_at_start.no)
Date: 03/30/05


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
checking.

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! ]


Relevant Pages

  • Re: Correct C++ tutorial chapter 2.1 "Classes" available (Windows, mingw/msvc/std)
    ... > Type safety merely mandates that the type of data objects is fixed and ... Type safety does not mandate that the type of data objects is fixed. ... C++ is a language that provides for type safety in some cases via dynamic type ...
    (comp.lang.cpp)
  • Re: arithmetic on a void * pointer
    ... <snip longish post by Richard heathfield> ... abstraction and type safety you would not use C. ... and partly because it was written in the high-level/low-level language ...
    (comp.lang.c)
  • Re: A new notion: stronglly-typed-by-user language
    ... means that there is not built-in type safety. ... I have shown that the language is capable of supporting user- ... if short and int are the same, and to the second one if long and int are ... type int is never subject to promotion. ...
    (comp.lang.ada)
  • Re: Static vs. Dynamic typing
    ... > and I make heavy use of type safety. ... I.e. were you making the anticipated mistakes and then ... Perhaps that's what language designers should be ... I suppose the limiting case would be that statically typed programming becomes ...
    (comp.object)
  • Re: Static vs. Dynamic typing
    ... > and I make heavy use of type safety. ... I.e. were you making the anticipated mistakes and then ... Perhaps that's what language designers should be ... I suppose the limiting case would be that statically typed programming becomes ...
    (comp.programming)