From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8de933d44255f226 X-Google-Attributes: gid103376,public From: stt@henning.camb.inmet.com (Tucker Taft) Subject: Re: Q: unboxed values and polymorphism Date: 1996/06/17 Message-ID: #1/1 X-Deja-AN: 160644482 sender: news@inmet.camb.inmet.com (USENET news) x-nntp-posting-host: henning.camb.inmet.com references: organization: Intermetrics, Inc. newsgroups: comp.lang.ada Date: 1996-06-17T00:00:00+00:00 List-Id: 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