Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!aurs01!throop From: throop@aurs01.UUCP (Wayne Throop) Newsgroups: comp.lang.misc Subject: Re: On whether C has first-class composable functions Message-ID: <59558@aurs01.UUCP> Date: 7 Feb 91 18:54:06 GMT References: <1991Feb5.144815.23239@spool.cs.wisc.edu> <1234:Feb520:27:2391@kramden.acf.nyu.edu> <1991Feb6.161639.18311@spool.cs.wisc.edu> <12547:Feb621:05:4491@kramden.acf.nyu.edu> Sender: news@aurs01.UUCP Lines: 38 > brnstnd@kramden.acf.nyu.edu (Dan Bernstein) >> quale@picard.cs.wisc.edu (Douglas E. Quale) >> Functions cannot be dynamically allocated in C. > 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. As a newcomer to this discussion, I'm puzzled. Let me see if I understand the point Dan is making. Is the point that one can code in C dynamically allocated entities which can be invoked or interpreted? If so, is it fair to say that C also "has" 1) garbage collection 2) associative arrays 3) generators 4) inheritance (or hey, go all the way) multiple inheritance in this sense? If not, why not? These seem to be much the same thing. ( To be honest, it seems much like Dan is answering the question "How many legs does a dog have if you call the tail a leg?" with "four", while Douglas answers "five". The disagreement in the case of the dog is what is meant by "calling" one object another. The disagreement in the case of composable functions is what is meant by a language "having" a feature. Further, the principle of least astonishment in use of language would make me answer "five" to the question about the dog, and "no" to the question about C having dynamically allocatable functions, because most people take the "calling" to affect what the term "leg" in the question references, and most people take "to have" to mean something closer to "available as a language primitive" rather than "can be composed in the language". ) Wayne Throop ...!mcnc!aurgate!throop