comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: Q: unboxed values and polymorphism
Date: 1996/06/15
Date: 1996-06-15T00:00:00+00:00	[thread overview]
Message-ID: <dewar.834881172@schonberg> (raw)
In-Reply-To: uvvyblp84l7.fsf@chaq.informatik.uni-tuebingen.de


Hannes asks

"I'm new to Ada and have a questions on polymorphism. The standard
way to have polymorphism in Ada are tagged records. But for my needs
this requires too much space. List cells would have a size of 3 words
instead of 2. I'd also have to put integers in records. This would
require too much time and space. I'd like to convert access values to
integers and do my own tagging. I could simply translate my C code.
But it would be nice to see how an experienced Ada programmer would do
this in Ada. Can I find some code that does this somewhere ?"

Use variant records. This is a very standard technique which you can
find described in any standard Ada text book, I would recommend
Barnes. Translating your C code would surely result in a horrible
montrosity! No respectable Ada programmers would convert access
values to integers except for very special low level purposes.





  parent reply	other threads:[~1996-06-15  0:00 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-15  0:00 Q: unboxed values and polymorphism Hannes Haug
1996-06-15  0:00 ` Jon S Anthony
1996-06-15  0:00 ` Robert Dewar [this message]
1996-06-16  0:00 ` Hannes Haug
1996-06-17  0:00   ` Tucker Taft
1996-06-17  0:00     ` Tucker Taft
1996-06-17  0:00   ` Tucker Taft
1996-06-17  0:00   ` Hannes Haug
1996-06-18  0:00     ` Fergus Henderson
1996-06-18  0:00     ` Robert Dewar
1996-06-22  0:00       ` Robert A Duff
1996-06-22  0:00         ` Robert Dewar
1996-06-22  0:00   ` Hannes Haug
1996-06-22  0:00     ` Robert Dewar
     [not found]       ` <uvvhgryr22d.fsf@chaq.informatik.uni-tuebingen.de>
1996-06-28  0:00         ` Robert Dewar
1996-07-02  0:00           ` Fergus Henderson
1996-06-18  0:00 ` Jon S Anthony
1996-06-19  0:00 ` Hannes Haug
replies disabled

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