comp.lang.ada
 help / color / mirror / Atom feed
From: stachour@umn-cs.CS.UMN.EDU (Paul Stachour)
Subject: Re: Procedure types and dynamic binding
Date: 24 Jan 89 04:07:37 GMT	[thread overview]
Message-ID: <10947@umn-cs.CS.UMN.EDU> (raw)
In-Reply-To: 1089@shuksan.UUCP

In article <1089@shuksan.UUCP> scott@shuksan.UUCP (Scott Moody) writes:
>> 
>> >    I haven't done an extended investigation of the literature, but
>> >    procedural variables in Algol-family languages would appear to
>> >    be a research topic
>>  <code not included> 
>> 
>> The final statement invokes the value of procvar, which is, of course,
>> "inner".  The call of inner references the variable X declared in outer,
>> which no longer exists.  This is the equivalent of the "dangling reference"
>> problem when the address of a local variable is assigned to a global
>> pointer.
>> 
>
In the Multics Implementation of PL/I, an procedure variable was
(not unsuprisingly) two items.  One was a pointer to the code
which was the procedure.  The 2nd was the "environment" of the
procedure at the point of the assignment.

Note that this allows:
   1) The code will thus update the correct "X" at any time,
      even when called from a highly-nested point, as it can find
      its "stack" and thus the "right x" to update.
   2) The code given in its original form to "detect" that there
      is no-such "X" to update, since there is no longer the
      version of "inner" that is "procvar" on the stack.  Detection
      of this stack-mismatch is easy in the example given, it is
      merely the fact that the stack is now "below" what it was at
      the point when the assignment "had effect".

  Of course, in the general case, where there may have been many calls
      in between, such a simple check would not work.  However, the simple
      matter of "gravestones", as used to detect dangling references,
      could be used with procedure-variables just as with naturals,
      or strings, or ...    ...Paul
     

  parent reply	other threads:[~1989-01-24  4:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-12-30 21:42 Procedure types and dynamic binding Erland Sommarskog
1988-12-31 17:46 ` Bob Hathaway
1989-01-05 10:02   ` William Thomas Wolfe,2847,
1989-01-07 18:05     ` Bob Hathaway
1989-01-07 21:21       ` William Thomas Wolfe,2847,
1989-01-08  1:49         ` Bob Hathaway
1989-01-08 19:01           ` William Thomas Wolfe,2847,
1989-01-08 23:10             ` Bob Hathaway
1989-01-09  1:47               ` William Thomas Wolfe,2847,
1989-01-09 20:19                 ` Bob Hathaway
1989-01-10  3:01                   ` William Thomas Wolfe,2847,
1989-01-10  3:06                   ` Bob Hathaway
1989-01-10 19:11                     ` William Thomas Wolfe,2847,
1989-01-11  2:08                       ` Bob Hathaway
1989-01-11 14:24                         ` William Thomas Wolfe,2847,
1989-01-11 17:51                           ` Barry Margolin
1989-01-11 22:54                             ` William Thomas Wolfe,2847,
1989-01-12 13:57                               ` Robert Firth
1989-01-12 19:09                                 ` William Thomas Wolfe,2847,
1989-01-14  0:46                                 ` Scott Moody
1989-01-15 18:28                                   ` William Thomas Wolfe,2847,
1989-01-24  4:07                                   ` Paul Stachour [this message]
1989-01-12  0:58                             ` William Thomas Wolfe,2847,
1989-01-12  6:12                               ` Barry Margolin
1989-01-11 14:48                         ` Submitting Ada 9X revision requests William Thomas Wolfe,2847,
1989-01-11  2:10                       ` Procedure types and dynamic binding Bob Hathaway
1989-01-05  7:38 ` William Thomas Wolfe,2847,
  -- strict thread matches above, loose matches on Subject: below --
1989-01-06 23:04 Erland Sommarskog
1989-01-07 22:20 ` William Thomas Wolfe,2847,
replies disabled

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