home *** CD-ROM | disk | FTP | other *** search
- 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
- From: chased@rbbb.Eng.Sun.COM (David Chase)
- Newsgroups: comp.std.c++
- Subject: Re: Use of nested functions (Was: Proposal for default scope)
- Date: 8 Jan 1993 21:42:16 GMT
- Organization: Sun
- Lines: 29
- Message-ID: <lkrt9oINNjq2@exodus.Eng.Sun.COM>
- References: <9300817.11209@mulga.cs.mu.OZ.AU> <1993Jan8.192906.2342@qualcomm.com>
- NNTP-Posting-Host: rbbb
-
- >Fergus James HENDERSON <fjh@munta.cs.mu.OZ.AU> writes:
- >>Many people seem to think that the purpose of nested functions is purely
- >>as encapsulation, a sort of code organization/modularization feature.
- >>... the real reason that they are useful is that ... their addresses can
- >>be passed to any function that just expects a function parameter.
- >>If a local function never has its address taken, then it does not use
- >>the full power of nested functions.
-
- greg@qualcom.qualcomm.com (Greg Noel) writes:
- >This is a valid point, but this is exactly the part that is expensive to
- >implement.
-
- This is not correct. Nested functions are not expensive to implement.
- I speak as someone who has done it. Compared to the costs of
- programming, and the potential wins (simpler interfaces, less
- temptation to use thread/signal-unsafe global variables) nested
- functions are a clear win.
-
- >The ``Spirit of C'' is that expensive things are exposed to the
- >programmer; C++ inherits much of this spirit.
-
- Is this good or bad? Does this decrease the cost of
- writing/maintaining programs? Does it make it easier for you to write
- reusable code? Does it lower the rate at which you introduce bugs to
- a program?
-
- David Chase
- Sun
-
-