🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #2592

Re: On whether C has first-class composable functions

#2592
From: Karl Heuer
Date: Sat, 05 Jan 1991 22:26
14 lines
1335 bytes
In article <1991Jan5.182428.615@mathrt0.math.chalmers.se> augustss@cs.chalmers.se (Lennart Augustsson) writes:
>[In C extended with anonymous functions, we could write compose():]
>	typedef int (*intintfun)(int);
>	intintfun compose(intintfun f, intintfun g) {
>	    return (int ANONYMOUS(int x) { return f(g(x))) };
>	}
>...the point is that you cannot add unnamed functions in a natural way
>without getting the additional semantic power.

I disagree.  Since the return value of the function references objects that go
out of scope before the value would be used, I would expect this to analogous
to   int *h(int i) { return &i; }   , which is undefined.

Karl W. Z. Heuer (karl@ima.isc.com or uunet!ima!karl), The Walking Lint
Technical Details
Message-ID: <1991Jan05.222639.6387@dirtydog.ima.isc.com>
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!clyde.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!mintaka!spdcc!ima!dirtydog!karl
References: <442@data.UUCP> <4408:Jan421:44:3391@kramden.acf.nyu.edu> <1991Jan5.182428.615@mathrt0.math.chalmers.se>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!clyde.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!mintaka!spdcc!ima!dirtydog!karl
From: karl@ima.isc.com (Karl Heuer)
Newsgroups: comp.lang.misc
Subject: Re: On whether C has first-class composable functions
Message-ID: <1991Jan05.222639.6387@dirtydog.ima.isc.com>
Date: 5 Jan 91 22:26:39 GMT
References: <442@data.UUCP> <4408:Jan421:44:3391@kramden.acf.nyu.edu> <1991Jan5.182428.615@mathrt0.math.chalmers.se>
Sender: news@dirtydog.ima.isc.com (NEWS ADMIN)
Organization: Interactive Systems
Lines: 14