home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18316 < prev    next >
Encoding:
Text File  |  1992-12-22  |  2.5 KB  |  53 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!rational.com!thor!rmartin
  3. From: rmartin@thor.Rational.COM (Bob Martin)
  4. Subject: Re: "type safety" deemed essential
  5. Message-ID: <rmartin.725046114@thor>
  6. Sender: news@rational.com
  7. Organization: Rational
  8. References: <1992Dec13.141400.5307@mole-end.matawan.nj.us> <1992Dec14.212143.15591@leland.Stanford.EDU> <rmartin.724430168@thor> <448@genie.UUCP>
  9. Date: Tue, 22 Dec 1992 17:41:54 GMT
  10. Lines: 41
  11.  
  12. roger@genie.UUCP (Roger H. Scott) writes:
  13.  
  14. |In article <rmartin.724430168@thor> rmartin@thor.Rational.COM (Bob Martin) writes:
  15. |>kocks@leland.Stanford.EDU (Peter Kocks) writes:
  16. |>
  17. |>>My $0.02.  Use Obj-C.  I have just spent a fair amount of time
  18. |>>comparing strong vs weak type casting systems [...]
  19. |>
  20. |>For any significant industrial application, I think strong typing is
  21. |>utterly essential.  It is just too easy to create horrible run time
  22. |>errors without type safety.  
  23.  
  24. |This sounds like theory rather than practice speaking.  Let's hear from the
  25. |(net) C++ user community: who has written a non-trivial commercial C++ 
  26. |application *without* making significant use of either type casting [(T *)]
  27. |or run-time type checking [Bar *bar_p = foo_p->asBar();]?  I maintain that
  28. |C++ makes it *very* difficult to do without at least one or the other of these
  29. |(Eiffel-style "anchored" virtual function return types would go a long way to
  30. |alleviate this).  I'm hoping that templates will help in this regard, but they
  31. |haven't been available long enough to judge.
  32.  
  33. There is no theory involved in the "horrible run time errors"
  34. description above.  I have spent many years writing C code and
  35. experiencing those errors.  There is also no theory involved in the
  36. reduction in those errors caused by strong typing.  Believe me, I have
  37. had plenty of, as you say, "practice".
  38.  
  39. Granted it is very difficult to create a large scale C++ application
  40. without using some type casting.  There are a number of reasons for
  41. this.  One of the most significant is contravariant return types.
  42. However, the standards committee has accepted covariant return types
  43. from virtual functions, so this source of typecasts will dissapear.
  44.  
  45. However, I am confused by your statement.  What does typecasting have
  46. to do with the need for strong typing in industrial languages???
  47.  
  48. --
  49. Robert Martin                        Training courses offered in:
  50. R. C. M. Consulting                       Object Oriented Analysis
  51. 2080 Cranbrook Rd.                        Object Oriented Design
  52. Green Oaks, Il 60048 (708) 918-1004       C++
  53.