comp.lang.ada
 help / color / mirror / Atom feed
From: rjh@cs.purdue.EDU (Bob Hathaway)
Subject: Re: procedure types
Date: 19 Jan 89 19:55:16 GMT	[thread overview]
Message-ID: <5865@medusa.cs.purdue.edu> (raw)
In-Reply-To: 4140@hubcap.UUCP

>    My idea was that if for example a procedure referenced an externally
>    defined variable X, then that and all other externally referenced
>    objects should form part of the procedure's specification.  Then if
>    the procedure was called in a context which did not include X, of
>    the type that X was expected to be, then an error similar to a 
>    "missing parameter" error would occur.  Since a specification now
>    includes all possible interactions between a procedure and its context, 
>    we should then be free to pass procedures around without restriction.

Typically, a procedure's environment is determined statically from its
declared environment and not dynamically at runtime.  There is also
binding of other objects X such as functions and packages, etc.  Your
approach appears to use dynamic binding of the procedural variables
environment; do you think this approach is better than the usual static 
binding rules of Ada objects?


>    Other advantages would accrue in that during debugging and maintenance,
>    it is frequently difficult to determine which global variables a 
>    procedure is referencing.  By requiring that a shield exist by default,
>    and providing a facility for poking holes in that shield, the compiler
>    can provide a guarantee that the list of externally referenced objects
>    is valid, eliminating the fact that one can never really be certain
>    that the documentation regarding what this procedure allegedly accesses
>    bears any relationship to the procedure's actual behavior.

I agree entirely.  In Modula, this can be accomplished by encapsulating a
procedure in a local module and exporting the procedure.  The import/export
mechanism can be used to provide explicit access to global variables.  But 
this is a clumsy approach and a primitive mechanism would be better.

                                             Bob Hathaway
                                             rjh@purdue.edu

  reply	other threads:[~1989-01-19 19:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-01-19  9:27 procedure types Mats Weber
1989-01-19 18:07 ` William Thomas Wolfe,2847,
1989-01-19 19:55   ` Bob Hathaway [this message]
1989-01-19 21:53     ` William Thomas Wolfe,2847,
  -- strict thread matches above, loose matches on Subject: below --
1989-01-09 12:37 Mats Weber
replies disabled

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