From -5424270311269842147
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 109fba,ac06fef48c3c04df
X-Google-Attributes: gid109fba,public
X-Google-Thread: f78e5,ac06fef48c3c04df
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1995-01-26 03:04:13 PST
Newsgroups: comp.lang.c++,comp.std.c++
Path: nntp.gmd.de!newsserver.jvnc.net!yale.edu!yale!yale!gumby!newsxfer.itd.umich.edu!gatech!psuvax1!uwm.edu!msunews!harbinger.cc.monash.edu.au!news.cs.su.oz.au!metro!news
From: maxtal@physics.su.OZ.AU (John Max Skaller)
Subject: Re: friends and local classes
Message-ID: <D30Er2.K65@ucc.su.OZ.AU>
Sender: news@ucc.su.OZ.AU
Nntp-Posting-Host: physics.su.oz.au
Organization: School of Physics, University of Sydney, Australia
References: <JGEALOW.95Jan22230221@mtl.mit.edu> <3g0kgm$gue@engnews2.Eng.Sun.COM> <FENSTER.95Jan24182929@ground.cs.columbia.edu>
Date: Thu, 26 Jan 1995 11:04:13 GMT
Lines: 57
Xref: nntp.gmd.de comp.lang.c++:88095 comp.std.c++:11260

In article <FENSTER.95Jan24182929@ground.cs.columbia.edu> fenster@ground.cs.columbia.edu (Sam Fenster) writes:
>
>clamage@Eng.Sun.COM (Steve Clamage) writes:
>
>> Who said local classes are a good idea? I think they are pointless.[...]  A
>> number of people on the C++ Committee would like to eliminate member
>> functions from local classes (myself included), although I don't expect that
>> to happen.
>
>Let's say you want to guarantee that some action takes place when a function
>exits, regardless of whether it's by any of a number of return statements,
>falling off the end, or because of an exception.  The only way is to create a
>local object with a destructor that performs the action.  That destructor must
>have the function's local variables in its scope:
>
>     void f () {
>        // ...
>        class On_Exit {~On_Exit() {delete foo; close(bar); baz--;};} on_exit;
>        // ...
>     }
>
>When Bjarne made "int i;" an executable statement so it could be put anywhere
>in a block, his rationale was that things should be declared where they are
>used.  The same goes for a class that is created for a local purpose.  And
>such classes must be allowed to have member functions.
>
>Ideally, we'd have local functions too, for similar reasons (e.g. a comparison
>function to pass to "qsort").  I don't expect that soon.  But let's not get
>rid of local classes, OK?


	If you want a "real" C++ compiler, try Metaware High C/C++.
It not only support nested (local) functions, but has a full
closure type.

	Sigh. In C++ almost everything except functions can be nested.
I consider that a gratuitous omission destroying the orthogonality
of the language. To me it is plain daft to provide full object
orientation and skip over the most basic structured programming
ideas. Structured programming may not be enough, but in 
two decades of research and experience we have learned, surely,
that "flat" languages like C and Cobol and Fortran have severe
problems. Now we have C++ which is "flat", but allows you
to break the global "flat" space up into little bits. (objects).

	So we have not learned that localisation and anonymity
are powerful ideas.  All we've done is permit partitioning
the flat space.  And I contend that _that_ is not enough:
within an object, we just have a miniture version of C, Cobol,
or Fortran. Gak.


--
        JOHN (MAX) SKALLER,         INTERNET:maxtal@suphys.physics.su.oz.au
	Maxtal Pty Ltd,		    
        81A Glebe Point Rd, GLEBE   Mem: SA IT/9/22,SC22/WG21 
        NSW 2037, AUSTRALIA	    Phone: 61-2-566-2189


