home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18283 < prev    next >
Encoding:
Internet Message Format  |  1992-12-22  |  2.7 KB

  1. Path: sparky!uunet!meaddata!ralpht
  2. From: ralpht@meaddata.com (Ralph W. Trickey)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: "type safety" deemed essential
  5. Date: 21 Dec 1992 20:25:37 GMT
  6. Organization: Mead Data Central, Dayton OH
  7. Lines: 43
  8. Distribution: world
  9. Message-ID: <1h5981INNf9a@meaddata.meaddata.com>
  10. References: <1992Dec13.141400.5307@mole-end.matawan.nj.us> <1992Dec14.212143.15591@leland.Stanford.EDU> <rmartin.724430168@thor> <448@genie.UUCP>
  11. NNTP-Posting-Host: retina.meaddata.com
  12.  
  13. In article <448@genie.UUCP>, roger@genie.UUCP (Roger H. Scott) writes:
  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. I have written several non-trivial commercial applications.
  34. Type-casting was required for collection classes because I was writing
  35. without templates, but it was used solely in accessor functions for
  36. the collection class. Run-time type information was required for
  37. persistency, and encapulated in it. I don't anticipate ever needing to
  38. use these features for more than that. C++ requires a different design
  39. methodology. If you have to query the object to find out what kind of
  40. object it is, you may want to re-think your design to find out where
  41. you lost that information.
  42.  
  43. I'm sorry, but I still remember the nightmares from programming in
  44. BASIC and assembler. I don't program in Smalltalk, but from what I
  45. have heard, it has the potential for the same problems. I want the
  46. compiler to guarantee that the class can handle the message, and that
  47. I won't spend days looking for w0rk.<G>
  48.  
  49. Ralph
  50.  
  51. -- 
  52. Ralph Trickey       | (513) 865-6800                  |        
  53. Mead Data Central   | x4870                           |  Disclaimer
  54. P.O. Box 933        | ralpht@meaddata.com             |  My opinions are my own
  55. Dayton, Ohio  45401 | ...!uunet!meaddata!ralpht       |
  56.