home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / cplus / 19772 < prev    next >
Encoding:
Internet Message Format  |  1993-01-23  |  3.8 KB

  1. Xref: sparky comp.lang.c++:19772 comp.object:5007
  2. Path: sparky!uunet!olivea!pagesat!netsys!news.cerf.net!network.ucsd.edu!lyapunov.ucsd.edu!mbk
  3. From: mbk@lyapunov.ucsd.edu (Matt Kennel)
  4. Newsgroups: comp.lang.c++,comp.object
  5. Subject: Re: Obj-C front for BC++ (was Re: Pros and cons of C++)
  6. Message-ID: <1jo9chINN48c@network.ucsd.edu>
  7. Date: 22 Jan 93 07:57:04 GMT
  8. References: <1993Jan18.165226.24600@leland.Stanford.EDU>
  9. Organization: Institute For Nonlinear Science, UCSD
  10. Lines: 67
  11. NNTP-Posting-Host: lyapunov.ucsd.edu
  12. X-Newsreader: Tin 1.1 PL3
  13.  
  14. kocks@leland.Stanford.EDU (Peter Kocks) writes:
  15. : In article <KERS.93Jan14092820@cdollin.hpl.hp.com>, kers@hplb.hpl.hp.com (Chris Dollin) writes:
  16. :     >Why would you ever want to run a program with a type error in it?
  17. : It is not that I wan to run a program with a type error, but rather I may want
  18. : to interact with another applications objects without knowing their type. 
  19. : Strong type checking makes this difficult.  Weak type checking (like in Obj-C)
  20. : makes this easy.  That is why NeXT uses Obj-C in their interface builder.  You
  21. : can dynamically add objects created by other vendors into the interface builder
  22. : and the connect them, without knowing if all the types match correctly.  Also
  23. : your application can be designed to message other applications, without knowing
  24. : what type the messaged application's object is. 
  25.  
  26. No these things always have a type. It's just that in the most
  27. general case the things is an $OB, to use Sather's notation.  Which means
  28. an OB (root class), or any of its descendants, (the $).
  29.  
  30. : In the future messaging between objects in different applications will become
  31. : more common.  In C++ this will create the need to define how that messaging
  32. : system will work.  The messaging system will employ some form of runtime
  33. : checking that will likely  be system depedent.   That is, MS will define its
  34. : own messaging system and Apple will define another.  This has probably already
  35. : happened.  If we all used Obj_C, this would be a lot easier (but not without
  36. : some problems).
  37.  
  38. This is an even harder problem. The question is of *interapplication*
  39. type conformance.  If you don't have the source of those programs,
  40. there's no way you can do it, unless the objects they pass back
  41. and forth are those defined in some standard library.  And then they
  42. have to make sure the internal type-tags are consistent across applications.
  43. I have no idea how to do that.
  44.  
  45. : Summary.  C++ is easier to for the developer to use now, but creates headaches
  46. : in the future.  Obj_C does not provide type checking making the developers job
  47. : harder now, but easier in the future.
  48.  
  49. I think OC is certainly superior to C++, but overall I'm a Sather bigot.
  50. You want static typing?  Say this
  51.    thing : TYPE;
  52.  
  53. The thing is type "TYPE".
  54.  
  55. you want dynamic typing? Say this
  56.    thing : $TYPE;
  57.  
  58. The thing is type TYPE, or any of TYPE's subclasses. 
  59. That's it.  It's very nice as you can specify static types when
  60. you need the speed, or use dynamic types when you want the flexibility---
  61. WITHOUT changing the class one single bit. (pun intended)  All classes
  62. can be used dynamically or statically.
  63.  
  64. The new Sather spec allows 'typecasing', which enables one to check
  65. whether objects are of specific types and then do specific things with them,
  66. without violating global type consitency. This way you, the programmer,
  67. can check the types yourself first before using the thing for anything,
  68. and if it checks out, you can assign that object to a variable of
  69. a definite specific class, with a guarantee that it's really that type.
  70. (saves time!).
  71.  
  72. : --Peter Kocks
  73. :   kocks@chemistry.stanford.edu
  74.  
  75. --
  76. -Matt Kennel          mbk@inls1.ucsd.edu
  77. -Institute for Nonlinear Science, University of California, San Diego
  78. -*** AD: Archive for nonlinear dynamics papers & programs: FTP to
  79. -***     lyapunov.ucsd.edu, username "anonymous".
  80.