🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6453

Re: first class functions

#6453
From: Stanley Chow
Date: Mon, 08 May 1989 02:44
49 lines
3170 bytes
In article <2883@crete.cs.glasgow.ac.uk> jack@cs.glasgow.ac.uk (Jack Campin) writes:
>
>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).
>

We have been using a proprietary language call PROTEL for some big projects. It
is a Pascal derrivative type language that has first class functions. We also
allow some control over environment but different from PS-algol. 

Basically, a "process" is composed of "modules", each module has its own
mini environment within the process environment. Each module can have a 
different instance of its own environment in each process.  When a procedure 
variable is created, the module environment is included. You could also construct
a procedure variable that runs in the corresponding module environment of
a *different* process. The system even keeps track of multiple instances
of one module in a proces!

PROTEL is pretty strict about types. (After all, it is PRocedure Oriented
Type Enforcing Language). The type of a procedure includes the types of
all the parameters. As it turns out, passing procedure around can get
very dangerous unless the type of a procedure is tracked everywhere.

Please e-mail me if you want more details. Some early versions of the l
anguage were discribed in SIGPLAN about ten years ago (I think).



Stanley Chow        BitNet:  schow@BNR.CA
BNR		    UUCP:    ..!psuvax1!BNR.CA.bitnet!schow
(613) 763-2831		     ..!utgpu!bnr-vpa!bnr-fos!schow%bnr-public
I am just a small cog in a big machine. I don't represent nobody.
Technical Details
Message-ID: <482@bnr-fos.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!bnr-vpa!bnr-fos!bnr-public!schow
References: <59111@yale-celray.yale.UUCP> <2883@crete.cs.glasgow.ac.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!bnr-vpa!bnr-fos!bnr-public!schow
From: schow@bnr-public.uucp (Stanley Chow)
Newsgroups: comp.lang.misc
Subject: Re: first class functions
Message-ID: <482@bnr-fos.UUCP>
Date: 8 May 89 02:44:04 GMT
References: <59111@yale-celray.yale.UUCP> <2883@crete.cs.glasgow.ac.uk>
Sender: news@bnr-fos.UUCP
Reply-To: schow%BNR.CA.bitnet@relay.cs.net (Stanley Chow)
Organization: Bell-Northern Research, Ottawa, Canada
Lines: 49