comp.lang.ada
 help / color / mirror / Atom feed
From: Hannes Haug <Hannes.Haug@Student.Uni-Tuebingen.de>
Subject: Re: Q: unboxed values and polymorphism
Date: 1996/06/16
Date: 1996-06-16T00:00:00+00:00	[thread overview]
Message-ID: <uvv7mt7ubgd.fsf@chaq.informatik.uni-tuebingen.de> (raw)
In-Reply-To: uvvyblp84l7.fsf@chaq.informatik.uni-tuebingen.de


>>>>> "Jon" == Jon S Anthony <jsa@organon.com> writes:

    Jon> In article <uvvyblp84l7.fsf@chaq.informatik.uni-tuebingen.de>
    Jon> Hannes Haug <Hannes.Haug@Student.Uni-Tuebingen.de> writes:
    >> 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

    Jon> If it helps, it also works this way in C++, Eiffel, Sather,
    Jon> and any other "statically" typed OO language.

    >> this requires too much space.

    Jon> Then you are in trouble no matter what.

But the trouble is not that big.


    >> 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.

    Jon> This sounds like a _really_ _really_ bad idea.  In your C,
    Jon> are you using "meta" bits (ala' Lisp impls) or what?

Sort of. 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.


    >> 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 ?

    Jon> I'm not sure what it is you are trying to do.  Make a list?
    Jon> Make a generic list?  Make a typed polymorphic list?  Make an
    Jon> untyped uncheckd programmer beware list?  What?

I need it for my computer algebra nucleus. I need lisp-like dynamic
typing. I cannot use tagged records. This would make a list cell 50%
bigger. This would mean 33% less list cells. And this would mean 50%
more garbage collections. I also need the type information on the stack
for my garbage collector. I cannot use records for fixnums either. This
would mean a "new" for every operation. My nagation takes ca. 20 nsec
for fixnums on a 90MHz hyperSPARC. With a "new" this would be a not so
little bit slower. Perhaps the usage of records for fixnums would even
make some functions too big for inlining.

 - hannes




  parent reply	other threads:[~1996-06-16  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 ` Robert Dewar
1996-06-15  0:00 ` Jon S Anthony
1996-06-16  0:00 ` Hannes Haug [this message]
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     ` 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-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