Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!rutgers!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.misc Subject: Re: On whether C has first-class composable functions Message-ID: <12547:Feb621:05:4491@kramden.acf.nyu.edu> Date: 6 Feb 91 21:05:44 GMT References: <1991Feb5.144815.23239@spool.cs.wisc.edu> <1234:Feb520:27:2391@kramden.acf.nyu.edu> <1991Feb6.161639.18311@spool.cs.wisc.edu> Organization: IR Lines: 36 In article <1991Feb6.161639.18311@spool.cs.wisc.edu> quale@picard.cs.wisc.edu (Douglas E. Quale) writes: > In article <1234:Feb520:27:2391@kramden.acf.nyu.edu> brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: > >As I said at the beginning of this discussion, you're wrong. The very > >first implementation posted (mine) dynamically allocated the composed, > >first-class functions. > I'm quite certain that you are completely, absolutely and undisputedly wrong. > Functions cannot be dynamically allocated in C. > C does not have first-class functions. You are making Jim Giles' mistake of confusing syntax and semantics. Just because the C standard calls certain language objects ``functions'' doesn't mean that it's impossible to implement functions that don't have the same restrictions as those objects. As a matter of fact, it's not only possible, it's trivial. The things that my implementation produced were not C functions, but they were full-fledged functions in all respects. We've hashed all this out before. (Everyone agrees with the above points when I say ``implement''; the problem before was that some people didn't like how I said ``C has first-class composable functions'' to mean ``first-class functions can be implemented in C.'') May I suggest that you review the beginning of a discussion before jumping into the end of it and throwing out ``you're wrong, wrong, wrong'' left and right? May I also suggest that you learn to distinguish the syntax of a language feature from its semantics? > I have serious doubts about whether you would know what to do with > dynamically allocated functions if you had them. I've written a noticeable amount of Forth code, and I once found it useful to implement dynamically allocated functions (in Pascal) for an intepreter. Other than that I've never seen much use for the things. ---Dan