From 4815249355350092235
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f78e5,fb1a92fa405c930c
X-Google-Attributes: gidf78e5,public
From: James.Kanze@dresdner-bank.com
Subject: Re: nested functions
Date: 1999/06/16
Message-ID: <7k5vjh$r0d$1@nnrp1.deja.com>#1/1
X-Deja-AN: 490113686
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <7jd4c5$nup$1@nnrp1.deja.com> <7jjjr6$r02$1@nnrp1.deja.com> <7jma5c$i85@abyss.West.Sun.COM> <7jmdcv$a56$1@engnews1.eng.sun.com> <7jrqf5$op5$1@nnrp1.deja.com> <7jrv0r$dfq$1@engnews1.eng.sun.com>
X-Original-Date: Tue, 15 Jun 1999 16:39:16 GMT
X-Http-User-Agent: Mozilla/4.6 [en] (WinNT; I)
X-Complaints-To: news@news.unimelb.edu.au
X-Http-Proxy: 1.0 x32.deja.com:80 (Squid/1.1.22) for client 193.194.7.71
X-Trace: izvestia.its.unimelb.edu.au 929505467 16695 128.250.29.16 (16 Jun 1999 03:57:47 GMT)
Organization: Deja.com - Share what you know. Learn what you don't.
X-Article-Creation-Date: Tue Jun 15 16:39:16 1999 GMT
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUAN2cgpuEDnX0m9pzZAQHhDwF+PCtY7ltTCTTR3DZlUZPGwaz14RT9ASI9 ec79IIi1yZTsvBIxacilP/w8ocGi2dkK =uRT4
NNTP-Posting-Date: 16 Jun 1999 03:57:47 GMT
Newsgroups: comp.std.c++

In article <7jrv0r$dfq$1@engnews1.eng.sun.com>,
  clamage@eng.sun.com (Steve Clamage) wrote:

> C++ has enough different scope control mechanisms you don't need
> local functions the way you need them in, say, Pascal. The
> primary reason to have local functions in C++ would be to
> implement closures. If you just want to share state among
> cooperating functions, use a class. The code will be simpler
> and easier to maintain.

Just a question of vocabulary, but what is a closure, exactly.  I've
always thought that, in layman's terms, it extended the life of the
local context beyond the return from the function.  I think that this is
how it works in lisp (but my lisp experience is limited to customizing
emacs, so I'm not sure).  And of course, Borland has invented a totally
different meaning.  What you are describing would seem to be closure as
I understand it, but without the extended lifetime.  Or are you
suggesting that Pascal extended the lifetime of the function context
beyond the return from the function if the address of the function was
taken.  (The Pascal I used didn't, but there are so many variations of
Pascal, it's hard to know what is standard, and what is fantasy on the
part of the implementer.)

--
James Kanze                         mailto:
James.Kanze@dresdner-bank.com
Conseils en informatique orient�e objet/
                        Beratung in objekt orientierter
Datenverarbeitung
Ziegelh�ttenweg 17a, 60598 Frankfurt, Germany  Tel. +49 (069) 63 19 86
27


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



