Xref: utzoo comp.object:555 comp.lang.c++:5738 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!gem.mps.ohio-state.edu!sunybcs!sbcs!allen From: allen@sbcs.sunysb.edu ( Allen Leung) Newsgroups: comp.object,comp.lang.c++ Subject: Re: Continuations Message-ID: <4109@sbcs.sunysb.edu> Date: 1 Dec 89 19:59:01 GMT References: <2664@bingvaxu.cc.binghamton.edu> <9624@pyr.gatech.EDU> <10008@june.cs.washington.edu> Sender: news@sbcs.sunysb.edu Lines: 34 In article <10008@june.cs.washington.edu>, peterd@cs.washington.edu (Peter C. Damron) writes: > 4. C and C++ have first class functions. Functions can be passed as > parameters, returned as function values, and assigned to variables. > The reason that C and C++ do not allow nested functions is precisely > so that they can have first-class functions implemented on a stack > (e.g. no closure required). The "parent block" of a function is > simply the global variables. > > Peter. > peterd@cs.washington.edu > {ucbvax,decvax,etc.}!uw-beaver!uw-june!peterd I must disagree. C and C++ definitely *don't* have first class functions. From a function programming view point, type alpha is first class means that values of alpha enjoy all the privilages granted to first class types. In terms of C this means you are supposed to be able to do things like this with functions: int(*)() foo( int y; ) { int x; // if you can local declare int/float/* ....etc float r; char *a; int bar( int z ) // you should be able to local declare bar { return y + z; } // y is free in bar but bound in foo return bar; } --Allen allen@sbcs.sunysb.edu Brought to you by Super Global Mega Corp .com