Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!bu.edu!m2c!jjmhome!smds!sw From: sw@smds.UUCP (Stephen E. Witham) Newsgroups: comp.lang.misc Subject: Re: On whether C has first-class composable functions Summary: Super-flexible "compose" is getting beyond "first-class." Message-ID: <298@smds.UUCP> Date: 17 Jan 91 22:06:07 GMT References: <442@data.UUCP> <4408:Jan421:44:3391@kramden.acf.nyu.edu> Organization: SMDS Inc., Concord, MA Lines: 31 In article , bbc@rice.edu (Benjamin Chase) writes: > Can a (reasonably efficient and portable) compose function for (all) C > functions be written in C?* I'm still waiting for that existence > proof... :-) I believe that it cannot be done. Actually, I'm not > really waiting for the existence proof. I don't really care to see > such code. Well, since you don't want to see it, I won't burdon you :-). Actually, I did think about it in my "purported" implementation of compose. At first glance, you're asking for something against the way C works with data types: a function that works even though you feed it arguments of different types at different times. For comparison, try writing a function that adds two numbers and returns a long--only the arguments may be chars, unsigned chars, shorts, unsigned shorts, ints, unsigneds or longs, or a combination. The original question was about "first-class" composable functions. I'm one of those who thinks that "first-class" is relative to what you can do with other things in the same language, so I think you're changing the rules here. But... Probably the most efficient way to do what you want would be to write different compose functions for different types of functions. On the other hand, since we're faking functions with structures, we might as well put declaration information into the structures. This might slow down the creation and composing of functions, but not their application. --Steve Witham Not-the-fault-of: SMDS, Concord, MA