comp.lang.ada
 help / color / mirror / Atom feed
From: stt@henning.camb.inmet.com (Tucker Taft)
Subject: Re: Q: unboxed values and polymorphism
Date: 1996/06/17
Date: 1996-06-17T00:00:00+00:00	[thread overview]
Message-ID: <Dt5KC9.9xE.0.-s@inmet.camb.inmet.com> (raw)
In-Reply-To: uvv7mt7ubgd.fsf@chaq.informatik.uni-tuebingen.de


One other thought...

Hannes Haug (Hannes.Haug@Student.Uni-Tuebingen.de) wrote:

: ...
: Fixnums are integers in the range -2^30 ... 2^30-1. Other
: integers are interpreted as pointers to (or indices in arrays of)
: bignums or list cells. And it is not a bad idea.

One of the nice things about Ada is that a private type can
be implemented with any sort of type.  So you could declare a private
type to represent one of these 32-bit multi-purpose number/pointers,
define "safe" operations in the visible part for using the type 
appropriately, and still implement it internally with a regular Integer 
(or whatever works best).  

Other OOP languages usually force all abstract data types to be
implemented using a record type, often with some "tag"-like overhead
(e.g. pointer to virtual function table, etc.).  

In a case like yours, a private type implemented with an Integer
would seem to give you the space efficiency you desire, and by
inlining the "access" subprograms you should be able to get the
necessary time efficiency, without sacrificing safety.

:  - hannes

-Tucker Taft   stt@inmet.com   http://www.inmet.com/~stt/
Intermetrics, Inc.  Cambridge, MA  USA




  parent reply	other threads:[~1996-06-17  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
1996-06-16  0:00 ` Hannes Haug
1996-06-17  0:00   ` Hannes Haug
1996-06-18  0:00     ` Robert Dewar
1996-06-22  0:00       ` Robert A Duff
1996-06-22  0:00         ` Robert Dewar
1996-06-18  0:00     ` Fergus Henderson
1996-06-17  0:00   ` Tucker Taft [this message]
1996-06-17  0:00   ` Tucker Taft
1996-06-17  0:00     ` Tucker Taft
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