From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5e40665f885c514,start X-Google-Attributes: gid103376,public From: vsnyder@math.jpl.nasa.gov (Van Snyder) Subject: Modest proposal, 1 of 3 Date: 1996/11/21 Message-ID: <572q86$g7m@netline-fddi.jpl.nasa.gov>#1/1 X-Deja-AN: 198010338 sender: vsnyder@math.jpl.nasa.gov (Van Snyder) content-type: text/plain; charset=US-ASCII organization: Jet Propulsion Laboratory mime-version: 1.0 newsgroups: comp.lang.ada Date: 1996-11-21T00:00:00+00:00 List-Id: BACKGROUND Suppose procedure A contains B, but not C and D. Suppose furthermore that an access-to-procedure type T that is compatible with B is visible to all three. Notwithstanding the visibility, A is not able to pass access-to-B to C as an argument. The reason is that C might store its formal argument of type access-to- procedure into a (relatively) global variable, and then D (or somebody else) could use it to call B after its up-level environment (A's local variables) disappears. The crucial problem is the ability of C to store access-to-B into a more global variable. Absent that ability, it's a trivial exercise in induction to show that B can only be invoked when its up-level exists. PROPOSAL for the next standardization of Ada Allow the "limited" keyword as an argument-passing mode, similar to "in". The interpretation is that arguments of mode "limited" can only be used to access something, or be bound as an actual argument to a formal argument of "limited" mode. In particular, as for other "limited" objects, assignment is not defined. Thus, one cannot store a copy of the argument into a more global variable. Then, allow access-to-procedure constants to be bound as actual arguments to formal arguments of the appropriate type, but only so long as the formal argument is of "limited" mode. -- What fraction of Americans believe | Van Snyder Wrestling is real and NASA is fake? | vsnyder@math.jpl.nasa.gov