home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12332 < prev    next >
Encoding:
Text File  |  1992-08-13  |  2.9 KB  |  76 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
  3. From: fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON)
  4. Subject: Re: Handling of operator . pro
  5. Message-ID: <9222714.28203@mulga.cs.mu.OZ.AU>
  6. Sender: news@cs.mu.OZ.AU
  7. Organization: Computer Science, University of Melbourne, Australia
  8. References: <memo.565691@cix.compulink.co.uk> <9222523.7061@mulga.cs.mu.OZ.AU> <1992Aug13.014043.20561@ucc.su.OZ.AU>
  9. Date: Fri, 14 Aug 1992 04:38:15 GMT
  10. Lines: 64
  11.  
  12. maxtal@extro.ucc.su.OZ.AU (John MAX Skaller) writes:
  13.  
  14. >In article <9222523.7061@mulga.cs.mu.OZ.AU> fjh@munta.cs.mu.OZ.AU (Fergus James HENDERSON) writes:
  15. >>Also you have to learn the advanced feature every time you are maintaining
  16. >>code that used it, even if that code could have been written using only
  17. >>simpler features.
  18. >
  19. >    I'm not so sure. Why is it harder to learn a properly conceived
  20. >language facility than to learn someones emulation of that facility
  21. >in reams of code? Sure you can read the code and deduce what it does,
  22. >but you are basically saying language manual writers ought to
  23. >write their manuals in C not english.
  24. >
  25. >    [BTW: I sometimes think this!]
  26.  
  27. One example is reference arguments. Without reference arguments, you know that
  28. a call like f(x) will not modify x [*]. In C++, even if YOU don't use reference
  29. arguments, you still have to check the declaration of f to be sure, because
  30. you don't know whether the writer of f did.
  31.  
  32.     [*] Sure, things are different for macros / array arguments, but
  33.         the point remains.
  34.  
  35. Here's another example: consider this hypthetical extension to C++ enum's.
  36.  
  37.     enum<<2 Bar {        // better use an operator (<<) rather than a
  38.         Fee,        // keyword, to make things more confusing :-)
  39.         Fie,
  40.         Foe,
  41.         Fum
  42.     };
  43.  
  44. Now this might be useful and convenient in some circumstances, but it adds to
  45. the complexity of the language and is yet another construct to remember.
  46. Instead you could just use standard C++ to achieve the desired effect, albeit
  47. slightly more verbosely:
  48.  
  49.     enum Bar {
  50.         Fee = 0x01,
  51.         Fie = 0x02,
  52.         Foe = 0x04,
  53.         Fum = 0x08,
  54.     };
  55.  
  56. Generally if a facility does provide a *large* reduction in the complexity
  57. of programs that need it, then it's not worth it.
  58.  
  59. >>I shouldn't have said PL/1 (I have never learnt that language, I was just
  60. >>repeating what I have heard and read). Instead I should have said C++ :-)
  61. >>
  62. >
  63. >    Some people complain about complexity of learning C++.
  64. >Bull. They have not traded off the advantages as compared to C.
  65.  
  66. If there's one thing that C++ does well, then that thing is making C obsolete.
  67. For C++, the competition will come from languages that are more powerful
  68. yet less complex; as Bjarne has said, C compatability is C++'s biggest strength
  69. and also its biggest weakness.
  70.  
  71. -- 
  72. Fergus Henderson             fjh@munta.cs.mu.OZ.AU      
  73. This .signature VIRUS is a self-referential statement that is true - but 
  74. you will only be able to consistently believe it if you copy it to your own
  75. .signature file!
  76.