comp.lang.ada
 help / color / mirror / Atom feed
* constant record components in Ada
@ 1997-06-27  0:00 Alexander V. Konstantinou
  1997-06-27  0:00 ` Stephen Leake
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Alexander V. Konstantinou @ 1997-06-27  0:00 UTC (permalink / 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




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1997-06-29  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-06-27  0:00 constant record components in Ada Alexander V. Konstantinou
1997-06-27  0:00 ` Stephen Leake
1997-06-27  0:00 ` Robert Dewar
1997-06-29  0:00   ` Alexander V. Konstantinou
1997-06-27  0:00 ` Samuel Tardieu

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