home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / std / cplus / 2011 < prev    next >
Encoding:
Internet Message Format  |  1993-01-08  |  1.7 KB

  1. Path: sparky!uunet!paladin.american.edu!howland.reston.ans.net!zaphod.mps.ohio-state.edu!wupost!cs.utexas.edu!sun-barr!news2me.EBay.Sun.COM!exodus.Eng.Sun.COM!rbbb.Eng.Sun.COM!chased
  2. From: chased@rbbb.Eng.Sun.COM (David Chase)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Use of nested functions (Was: Proposal for default scope)
  5. Date: 8 Jan 1993 21:42:16 GMT
  6. Organization: Sun
  7. Lines: 29
  8. Message-ID: <lkrt9oINNjq2@exodus.Eng.Sun.COM>
  9. References: <9300817.11209@mulga.cs.mu.OZ.AU> <1993Jan8.192906.2342@qualcomm.com>
  10. NNTP-Posting-Host: rbbb
  11.  
  12. >Fergus James HENDERSON <fjh@munta.cs.mu.OZ.AU> writes:
  13. >>Many people seem to think that the purpose of nested functions is purely
  14. >>as encapsulation, a sort of code organization/modularization feature.
  15. >>... the real reason that they are useful is that ... their addresses can
  16. >>be passed to any function that just expects a function parameter.
  17. >>If a local function never has its address taken, then it does not use
  18. >>the full power of nested functions.
  19.  
  20. greg@qualcom.qualcomm.com (Greg Noel) writes:
  21. >This is a valid point, but this is exactly the part that is expensive to
  22. >implement.
  23.  
  24. This is not correct.  Nested functions are not expensive to implement.
  25. I speak as someone who has done it.  Compared to the costs of
  26. programming, and the potential wins (simpler interfaces, less
  27. temptation to use thread/signal-unsafe global variables) nested
  28. functions are a clear win.
  29.  
  30. >The ``Spirit of C'' is that expensive things are exposed to the
  31. >programmer; C++ inherits much of this spirit.
  32.  
  33. Is this good or bad?  Does this decrease the cost of
  34. writing/maintaining programs?  Does it make it easier for you to write
  35. reusable code?  Does it lower the rate at which you introduce bugs to
  36. a program?
  37.  
  38. David Chase
  39. Sun
  40.  
  41.