comp.lang.ada
 help / color / mirror / Atom feed
From: cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland. reston.ans.net!noc.near.net!inmet!spock!stt@ucbvax.Berkeley.EDU  (Tucker Taft)
Subject: Re: Passing procedures as parameters to procedures.
Date: 4 May 93 15:43:19 GMT	[thread overview]
Message-ID: <C6IEC8.M2F@inmet.camb.inmet.com> (raw)

In article <1993May4.102922.16895@sei.cmu.edu> 
firth@sei.cmu.edu (Robert Firth) writes:

>In article <C6I9J9.J9E@inmet.camb.inmet.com> 
stt@spock.camb.inmet.com (Tucker Taft) writes:

>. . . There are certainly languages where procedures
>>are first class objects, and can be freely assigned, passed around,
>>returned from functions, etc.  Such languages (e.g. Scheme) typically require
>>garbage collection, and the ability to have the activation record
>>for a subprogram on the heap.  
>
>Well, I've implemented three such languages, and none of them required
>garbage collection, activation records on the heap, or anything one
>tenth as complicated.  There is exactly one semantic problem with
>procedures as first class objects, and its the exact same problem as
>you have with variables as first class objects: references from more
>global entities to more local entities.  The usual simple solutions
>apply.  The simplest, and one made very easy by Ada's abstraction and
>packaging capability, is to rule that nested procedures are not first
>class.  Modula-2 has the same rule, and it made implementation of
>procedure values and variables very straightforward.

Unfortunately, in the example, the procedure was nested.
It is certainly true that if you only want un-nested
procedures to be "first class" then there is no problem.
Based on the example, I presumed the original questioner
was interested in a more general concept of "first class procedures."

Note, also, that the generic "contract" model interacts badly
with restrictions related to nesting.

In any case, I think Robert and I are in general agreement.
You can call these references "subprograms" or "access-to-subprograms,"
but if you want to avoid garbage collection, etc., you have to
live with some limitations on references to nested subprograms.

S. Tucker Taft  stt@inmet.com

             reply	other threads:[~1993-05-04 15:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-05-04 15:43 Tucker Taft [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-05-10 22:56 Passing procedures as parameters to procedures Jack Dean
1993-05-06  9:39 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!darwi
1993-05-06  7:33 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!torn!
1993-05-05 21:35 cis.ohio-state.edu!news.sei.cmu.edu!ajpo.sei.cmu.edu!progers
1993-05-05 17:39 Robert Dewar
1993-05-05 17:35 Robert Dewar
1993-05-05 16:30 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!us
1993-05-05 11:40 cis.ohio-state.edu!news.sei.cmu.edu!firth
1993-05-05  9:50 cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland.
1993-05-04 23:44 cis.ohio-state.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!ho
1993-05-04 22:13 John Goodsen
1993-05-04 19:39 cis.ohio-state.edu!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!m
1993-05-04 16:41 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!howland.reston.ans.net!ira.u
1993-05-04 16:25 Mark A Biggar
1993-05-04 14:29 cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uwm.edu!spool.mu.edu!
1993-05-04 13:59 Tucker Taft
1993-05-04 13:45 cis.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!howland.
1993-05-04 13:45 cis.ohio-state.edu!pacific.mps.ohio-state.edu!linac!uwm.edu!cs.utexas.edu
1993-05-04 10:25 cis.ohio-state.edu!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!us
1993-05-03 20:36 Mark A Biggar
1993-05-03 19:07 cis.ohio-state.edu!magnus.acs.ohio-state.edu!zaphod.mps.ohio-state.edu!ho
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox