comp.lang.ada
 help / color / mirror / Atom feed
From: Alexander V. Konstantinou <akonstan@sutton.cs.columbia.edu>
Subject: constant record components in Ada
Date: 1997/06/27
Date: 1997-06-27T00:00:00+00:00	[thread overview]
Message-ID: <5p100i$pvn@sutton.cs.columbia.edu> (raw)


I am trying to obtain in Ada (95) the same functionality of the C++ struct
declaration :

	struct map_pair {
		const Key_Type first;
		Value_Type second;
	}

The idea is to provide a record in which the key value is constant, and the
value type is mutable.  The Ada books I have looked at suggest using
discriminants.  Unfortunately, discriminants have to be either discrete or
access types.  In my case Key_Type is a generic parameter and restricting it
to be a discrete type is too restrictive.  On the other hand, making the
discriminant a pointer is in my view an ugly solution since it keeps that
extra pointer around.

Any ideas on how to tackle this ?

Alexander V. Konstantinou
-- 
Alexander V. Konstantinou              http://www.cs.columbia.edu/~akonstan/
akonstan@cs.columbia.edu               akonstan@acm.org




             reply	other threads:[~1997-06-27  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-27  0:00 Alexander V. Konstantinou [this message]
1997-06-27  0:00 ` constant record components in Ada Samuel Tardieu
1997-06-27  0:00 ` Stephen Leake
1997-06-27  0:00 ` Robert Dewar
1997-06-29  0:00   ` Alexander V. Konstantinou
replies disabled

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