comp.lang.ada
 help / color / mirror / Atom feed
From: Evans@TL-20B.ARPA ("Art Evans")
Subject: renaming types
Date: Fri, 26-Jun-87 13:28:28 EDT	[thread overview]
Date: Fri Jun 26 13:28:28 1987
Message-ID: <8706270326.AA26169@ucbvax.Berkeley.EDU> (raw)

Ada does not permit renaming types, the syntax in ARM 8.5 not including
any way to do so.  In general, the rationale for this lack is that a
subtype declaration can be used instead.  However, using a subtype does
not work in all cases.

What I want is something like this:
	with B;				-- Package exporting a type.
	package A is
	   type T is private;		-- A private type.
	   ...
	private
	   type T renames B.BT;		-- Illegal!
	end A;
The renaming declaration is of course illegal.  Moreover, the subtype
mechanism doesn't help, since there's no such thing as a 'private
subtype' declaration and a private type may not be completed with a
subtype.

I see no clean way out of this problem.  The problem can be solved (sort
of) by completing the private type declaration with either of 
	   type T is record
	      F: B.BT;
	   end record;
or
	   type T is access B.BT;
I find both of these to be pretty ugly.  Either affects all code that
uses objects of the type.

Has anyone a better solution?  This matter looks like a candidate for
consideration when Ada is next revised.

Art Evans
Tartan Labs
-------

             reply	other threads:[~1987-06-26 17:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1987-06-26 17:28 "Art Evans" [this message]
     [not found] <259745@QZCOM>
1987-06-28  0:08 ` renaming types "Johan Backlund FOA221"
1987-06-29 17:16   ` Robert Stockton
  -- strict thread matches above, loose matches on Subject: below --
1987-06-29 13:07 Emery
1987-06-29 13:24 Emery
replies disabled

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