Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!seismo!rochester!pt!k.cs.cmu.edu!rgs
From: rgs@k.cs.cmu.edu (Robert Stockton)
Newsgroups: comp.lang.ada
Subject: Re: renaming types
Message-ID: <1175@k.cs.cmu.edu>
Date: Mon, 29-Jun-87 13:16:49 EDT
Article-I.D.: k.1175
Posted: Mon Jun 29 13:16:49 1987
Date-Received: Sun, 5-Jul-87 20:17:48 EDT
References: <259745@QZCOM> <259760@QZCOM>
Distribution: world
Organization: Carnegie-Mellon University, CS/RI
Lines: 38


Using type derivation to achieve renaming can be effective in some cases,
but has its own problems.  In particular, it can lead to problems when
dealing with multiple types defined in a single package.  Consider the
following case:

  package lists is
    type List is private;
    type List_Iterator is private;
    ...
    function Make_List_Iterator(L : List) return List_Iterator;
  private
    ...
  end lists;

  with lists; use lists;
  package rename_lists is
    type New_List is private;
    type New_List_Iterator is private;
  private
    type New_List is new List;
    type New_List_Iterator is new List_Iterator;
  end rename_lists;

At this point we have derived functions
  function Make_List_Iterator(L : List) return New_List_Iterator;
  function Make_List_Iterator(L : New_List) return List_Iterator;
Unfortunately, the one we are likely to want to use is
  function Make_List_Iterator(L : New_List) return New_List_Iterator;
which is not defined.  The only way to make use of the derived function is
to employ an explicit type conversion, which seems unreasonable in this case.

I would be quite pleased if someone could prove me wrong on this point.  Am
I missing something?

                                        -Robert Stockton
					 rgs@spice.cs.cmu.edu
					 ...!seismo!cmu-cs-k!rgs