Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!lavaca.uh.edu!menudo.uh.edu!sugar!ficc!peter From: peter@ficc.ferranti.com (Peter da Silva) Newsgroups: comp.lang.c Subject: Re: function composition in C Message-ID: <5SX9XUC@xds13.ferranti.com> Date: 6 Mar 91 19:28:04 GMT References: <6873@munnari.oz.au> <9754@uwm.edu> <1991Mar2.224617.2613@Neon.Stanford.EDU> Reply-To: peter@ficc.ferranti.com (Peter da Silva) Organization: Xenix Support, FICC Lines: 12 See my recent article in comp.lang.misc. In general you can't compose normal functions in any language that doesn't have an interpreter stage, such as lisp or an object-oriented language like SmallTalk. But you can implement objects in C: this is what C-preprocessors like CO2 and C++ do. They basically write a micro-interpreter for function calls using a jump-table, and convert calls to these objects into calls to an application function and an indirection through this jump-table. You can do the same thing on a smaller scale to get the effect of first-class functions: but these first-class functions are *not* C functions. -- Peter da Silva. `-_-' peter@ferranti.com +1 713 274 5180. 'U` "Have you hugged your wolf today?"