comp.lang.ada
 help / color / mirror / Atom feed
From: rfg@ics.uci.edu (Ron Guilmette)
Subject: Adding Multiple Inheritance (was: Modernizing Ada)
Date: 14 Oct 89 19:13:38 GMT	[thread overview]
Message-ID: <1989Oct14.121338.1316@paris.ics.uci.edu> (raw)
In-Reply-To: 8910132028.AA07013@helios.enea.se

In article <8910132028.AA07013@helios.enea.se> sommar@enea.se (Erland Sommarskog) writes:
>  It's easy to say "multiple inheritance" but it should be
>implemented too. And I'm not talking compiler technology here.
>My issue is the langauge definition. The inheritance mechanism
>should integrated with existing constructs in Ada. Say that you add
>classes a new compilation unit to Ada. Easy? Yes, but why then
>keep packages? OK, make the classes package types, but somehow
                                     ^^^^^^^^^^^^^
>I feel that we will ending up having something in the langauge
>that will be obsolete once we have a inheritance mechanism, multiple
>or not.

>All this said with the following reservation: I haven't seen
>any concrete proposal on how an inheritance mechanism in Ada
>should be look like. Therefore is my discussion on the consequences
>on such a construct somewhat hypothetical, but so is everybody
>else's too.

Well... I know that I'm definitely *not* the only one to have started to
think about how to munge MI into Ada, and I may just be putting my foot
in my mouth here, but I wonder if anybody here would like to start
discussing the pros and cons of various schemes for adding MI to Ada.

The addition of PACKAGE TYPES (kinda like task types, only different)
seems like a nice way to add the notion of CLASSES without adding another
keyword.  Seems to me like the syntax & semantics of member references
should just fall out also. If we just added a statement called "inherit"
then we would be in business. For instance:

	package type PT_1 is

		procedure FOO;

	end PT_1;

	package type PT_2 is

		type PT_2_TYPE is private;

	private

		type PT_2_TYPE is ...;

	end PT_2;

	with PT_1, PT_2;
	package type PT_3 is

		inherit PT_1 as PART_1;
		inherit PT_1 as PART_2;
		inherit PT_2 as PART_3;

		VAR : INTEGER;

		procedure MEMBER_PROC (I : INTEGER);

	end PT_3;

	procedure USE_THEM is
	begin
		THREE_VAR	: PT_3;
		WEIRD		: PT_3.PART_3.PT_2_TYPE;	-- private type

		...

		THREE_VAR.VAR := 99;

		THREE_VAR.MEMBER_PROC (99);

		THREE_VAR.PART_2.FOO := 99;

	end USE_THEM;


Any comments?
// rfg

  reply	other threads:[~1989-10-14 19:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1989-10-13 20:28 Modernizing Ada Erland Sommarskog
1989-10-14 19:13 ` Ron Guilmette [this message]
1989-10-14 20:38   ` Adding Multiple Inheritance (was: Modernizing Ada) Edward Berard
1989-10-15 20:57     ` Scott Simpson
1989-10-15  1:16   ` Dik T. Winter
1989-10-14 20:50 ` Modernizing Ada William Thomas Wolfe, 2847 
1989-10-15  9:54   ` Richard O'Keefe
1989-10-15 17:44     ` COBOL (Was: Modernizing Ada; now moving to comp.lang.misc) William Thomas Wolfe, 2847 
1989-10-16  3:50       ` Richard O'Keefe
1989-10-17  0:46         ` Modernization 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