function composition in C

Peter da Silva peter at ficc.ferranti.com
Thu Mar 7 05:28:04 AEST 1991


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 at ferranti.com
+1 713 274 5180.  'U`  "Have you hugged your wolf today?"



More information about the Comp.lang.c mailing list