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: Hannes Haug Subject: Re: Q: unboxed values and polymorphism Date: 1996/06/22 Message-ID: #1/1 X-Deja-AN: 161564915 sender: haugha@chaq.informatik.uni-tuebingen.de references: organization: Uni Tuebingen newsgroups: comp.lang.ada Date: 1996-06-22T00:00:00+00:00 List-Id: >>>>> "Robert" == Robert Dewar writes: Robert> Hannes says "But will this give me unboxed integers and Robert> type information on the stack ? I'd try a private type Robert> that's actually an integer. I'd use half of this integers Robert> (-2**30 ... 2**30-1) for my fixnums. Values outside this Robert> range would be indices in arrays of bignums or list Robert> cells. So I'd have unboxed integers and type information Robert> on the stack." Robert> You are encoding at a very low level, appropriate for C Robert> (since it is the only way to do things), but totally Robert> inappropriate for Ada. You need a variant record with a Robert> discriinant to indicate whether you have fixnums or Robert> indices. The discriminant would be a single bit. Absolutely not. On the stack I have words and not records. I work at a low level because it is necessary. I really don't want to have a explicit bit. I don't want to wrap/unwrap my data. Otherwise I would choose the low bits as tag bits. This has nothing to do with C or Ada. It has to do with costs of type checks, tagging, untagging and arithmetic on tagged integers. If you keep telling people that this is evil they will never implement lisp, prolog, ... in Ada. -hannes