comp.lang.ada
 help / color / mirror / Atom feed
From: David Holm <david@realityrift.com>
Subject: Re: generic type identification
Date: Sat, 04 Jan 2003 12:39:22 GMT
Date: 2003-01-04T12:39:22+00:00	[thread overview]
Message-ID: <_BAR9.4055$FF4.251139@newsb.telia.net> (raw)
In-Reply-To: qsuR9.551617$WL3.150846@rwcrnsc54

tmoran@acm.org wrote:

>> The alternative, I guess, would be to not use a generic package and
>> instead overload Some_Procedure with those types that I want to be able
>> to use but this will clutter the specification file =(.
>     Not to mention that you will have to add to package Example every time
> someone wants to use your Some_Procedure with a new type.
>   Why do you want Some_Procedure to know what type it was instantiated
> with?  How much does it need to know about that type - just whether it's
> integer or float or modular, or does it need to know whether it's
> My_Pleasant_Centigrade or not?

It is a thick binding to OpenGL. In case you have never seen the OpenGL API 
it has one procedure for every type you can access it with.
For instance, glVertex has 24 different declarations depending on whether 
you use (C) floats, doubles, integers, shorts etc and whether your send it 
an array of 2, 3 or 4 coordinates with any of these types.
I was hoping to be able to create one interface for this in Ada (possibly by 
using generic instead of overloading every procedure). But then I would 
need to be able to identify which type is used in a call to say 
AdaGL.Primitives.Vertex(some array) so that I know which binding to the C 
library I should convert the parameters to and then call.

Perhaps I could go with something like this?
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=8903101703.AA04518%40ti.com

//David Holm



  reply	other threads:[~2003-01-04 12:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-04  1:50 generic type identification David Holm
2003-01-04  2:04 ` chris.danx
2003-01-04  5:39 ` tmoran
2003-01-04 12:39   ` David Holm [this message]
2003-01-04 16:13     ` James S. Rogers
2003-01-05  3:28       ` David Holm
2003-01-05 10:03         ` Gautier
2003-01-04 19:27     ` tmoran
2003-01-05  3:25       ` David Holm
2003-01-05  5:42         ` tmoran
2003-01-06 17:56     ` Stephen Leake
replies disabled

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