🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6445

Re: first class functions

#6445
From: Jack Campin
Date: Wed, 03 May 1989 10:40
35 lines
2497 bytes
budd@mist.CS.ORST.EDU (Tim Budd) wrote:

> I'm looking for examples (if any) of any compiled, possibly strongly typed,
> languages in which functions/procedures are first class values (i.e., can be 
> stored in variables, can be sent as arguments to other functions, can be 
> returned as the result of a function, and so on).

PS-algol does this.  I posted a list of tech reports about it to the
comp.doc.techreports newsgroup a few months ago.  The extra feature it has
beyond what you're asking for, and the critically important one, is the
ability to make functions persistent - thus a partial application of a
procedure can be constructed and later reinvoked at any time *with the
environment of its creation*.  This gives the full power of a typed module
facility, but without the restriction that module bindings have to happen at
"link time".  It compiles to an abstract machine code for an interpreter.
It's strongly typed, sort of (well, stronger than Scheme, anyway; some sort of
get-out is needed to handle long-term persistent data with reasonable
flexibility - PS-algol treats complex objects as all having the same compile-
time type but imposes run-time type checks on accesses to their insides).

The one thing you can't do is use procedure closures as keys for associative
data structures, though we've done some experiments towards this.

Of course ML and Miranda-like languages have "first class" procedures too, but
without persistent closures they are limited in what they can do with them.

[ I couldn't get this to comp.compilers by following up - does
  anyone know a good way to reach the moderator from the UK? ]

-- 
Jack Campin  *  Computing Science Department, Glasgow University, 17 Lilybank
Gardens, Glasgow G12 8QQ, SCOTLAND.    041 339 8855 x6045 wk  041 556 1878 ho
INTERNET: jack%cs.glasgow.ac.uk@nsfnet-relay.ac.uk  USENET: jack@glasgow.uucp
JANET: jack@uk.ac.glasgow.cs     PLINGnet: ...mcvax!ukc!cs.glasgow.ac.uk!jack
Technical Details
Message-ID: <2883@crete.cs.glasgow.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!indri!ames!lll-lcc!lll-winken!uunet!mcvax!ukc!strath-cs!glasgow!jack
References: <10253@orstcs.CS.ORST.EDU> <59111@yale-celray.yale.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!indri!ames!lll-lcc!lll-winken!uunet!mcvax!ukc!strath-cs!glasgow!jack
From: jack@cs.glasgow.ac.uk (Jack Campin)
Newsgroups: comp.lang.misc
Subject: Re: first class functions
Message-ID: <2883@crete.cs.glasgow.ac.uk>
Date: 3 May 89 10:40:34 GMT
References: <10253@orstcs.CS.ORST.EDU> <59111@yale-celray.yale.UUCP>
Reply-To: jack@cs.glasgow.ac.uk (Jack Campin)
Organization: COMANDOS Project, Glesga Yoonie, Unthank
Lines: 35