composition of functions

Stephen E. Witham sw at smds.UUCP
Fri Feb 15 04:12:57 AEST 1991


In article <17621 at gremlin.nrtc.northrop.com>, kkenny at wind.nrtc.northrop.com (Kevin B. Kenny KE9TV) writes:
> Reading all the flamage about composable functions, I am forced to
> note that everyone appears to agree:
> 	(1) Functions are not first-class objects in C
> 	(2) Composition is a difficult notion to express in C.
> The disagreements are on the subject of whether this problem is a
> major failing in the language.

I don't agree with number two.  I think composing functions in C is pretty
easy and useful.  In fact, I think quite a few others either know this
or would grudgingly admit it, or suspect that it's true.  But the religious
fervor is concentrated on the "first-classness" issue.  

The problems with doing it in C center around:
   o  Composing functions that take and return more than one type.
   o  The impossibility of using composed functions interchangeably with
      regular C functions.
   o  The fact that you have to take care of deallocating things.

My impression from your posting is that C++ can do this stuff a little
more easily than C, but that it still has these problems.  But I can't
read C++, so could you comment on these particular thorns?

--Steve Witham
Not-the-fault-of: SMDS, Inc., Concord, MA



More information about the Comp.lang.c mailing list