comp.lang.ada
 help / color / mirror / Atom feed
From: billwolf@hubcap.clemson.edu (William Thomas Wolfe,2847,)
Subject: Re: Procedure types and dynamic binding
Date: 8 Jan 89 19:01:59 GMT	[thread overview]
Message-ID: <4042@hubcap.UUCP> (raw)
In-Reply-To: 5793@medusa.cs.purdue.edu

From article <5793@medusa.cs.purdue.edu>, by rjh@cs.purdue.EDU (Bob Hathaway):
>>     all we need is the ability to have pointers which are not bound
>>     to any specific type.  Most of the time we want to say "pointer to
>>     SPECIFIC_TYPE", but sometimes we just want to say "pointer".  Given
>>     the ability to specify an unrestricted pointer, we can implement
>>     the desired stack (or whatever) of any element type. 
> 
> But this assumes no type or error checking at all.  By dynamic 
> parameterization I meant with runtime type and error checking.  

    The same runtime type and error checking will occur with
    the unrestricted pointers.  When an operation is applied
    to the object pointed to, the type of that object will
    be used to determine which code to invoke or to prove
    the existence of a run-time error.  Now I see no reason
    why we can't say "pointer to TYPE_1 or TYPE_2 (etc.)",
    thus introducing a new form of restricted pointer, but
    what we are dealing with here is the need to store 
    any type of object whatsoever.  Clearly, unrestricted 
    pointers, with their associated run-time costs, should 
    only be used when their power is absolutely necessary. 

> For static typechecking of data we can use a pointer to a tagged variant 
> record to distinguish types.  This assumes foreknowledge of the types in 
> the variant but at least allows subprograms to distinguish objects.   

    What you describe is a hack which would provide (less cleanly) the
    power provided by the form of restricted pointer described above.

    This is inappropriate to the problem under discussion, which 
    assumes the need to program a polymorphic stack without foreknowledge
    of the types of objects to be stacked.

> but what about dynamically parameterized operations?  Ada has an address 
> type applicable to function and task type addresses but this is 
> implementation dependent and there is no defined typechecking mechanism 
> for the subprogram parameter structure as there is with procedural 
> variables.  Unbound pointers to functions have the same consequences.  
> While tasks can allow procedural abstraction, better is a higher order 
> construct such as procedural variables.

     I have described in earlier articles mechanisms by which the
     desired effects can be achieved in a more intuitive manner.

     Please provide a concrete example in which the provided
     mechanisms would prove inadequate.

>>  Now set up your abstraction to provide a "current node" concept,
>>  along with operations like DESCEND_LEFT, DESCEND_RIGHT, and ASCEND.
>>  This can be implemented either via parent pointers or via a secret
>>  stack which holds the path of descent used to reach the current node.
> 
> Yes this would work, but leaves programmers to build their own traversal 
> routines.  My idea was to provide a mechanism allowing programmers to specify
> a procedural invocation in a single, simple statement and have the Adt
> select and carry out the operation implicitly.

   But wasn't the basis of your argument the claim that the usual
   preorder, postorder, and inorder traversal schemes may not be
   enough?  The solution to this question is clearly to proceed
   as I have described.  Perhaps you could clarify the problem
   under consideration and the precise nature of your solution...



                                    Bill Wolfe

                             wtwolfe@hubcap.clemson.edu
 

  reply	other threads:[~1989-01-08 19:01 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, [this message]
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
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