From: BrianG <briang000@gmail.com>
Subject: Re: OpenGL in Ada
Date: Sat, 10 Jul 2010 22:45:02 -0400
Date: 2010-07-10T22:45:02-04:00 [thread overview]
Message-ID: <i1bb1e$h55$1@news.eternal-september.org> (raw)
In-Reply-To: <d534f9a1-147b-4fb3-9d22-840287aff113@z8g2000yqz.googlegroups.com>
Gautier write-only wrote:
> On 10 juil, 06:00, BrianG wrote:
>
>> One problem you'll have is if a user wants to make a call with all
>> literals, i.e. Color(1, 2, 3) or Color(1.0, 2.0, 3.0), the
>> compiler won't know which version to use.
>
> Sure it will know!
> The confusion is rather when the GL.Float and the GL.Double versions
> are named Color. One solution is to choose one type as "most common"
> per category (floating-point, integer), and for instance name "Color"
> for GL.Double and Color_f for GL.Float:
>
> http://globe3d.sourceforge.net/g3d_html/gl__ads.htm#3437_13
>
> There is also an automatic tool to generate these parts of bindings in
> a consistent manner, with Import pragmata etc. - just use it (or the
> binding itself...).
>
> G.
I don't understand your "rather"; that's exactly my point. See the
start of my post.
This doesn't just apply to Float/Double, it also applies to
Byte/Short/Int/Long (etc.). That's why I specifically included those
versions of the calls in my post.
What you have is a way to do it, but that's not what the OP posted. He
had all procedures named Color, so the user doesn't need to worry about
implementation. (If I use Color for Double and want to change my
program to use Float, I have to change the names of all calls, even if I
use calls where the compiler could determine what I want - and not just
calls to Color, many routines would have the same issue.) This is also
what the OpenGL documentation implies should be done in a language like Ada.
You could have both Color and Color_F for Float (which is part of what
my point was). Then you could also have Color and Color_I for Int,
which was the other part of my point: Color_F and Color_I don't have to
have different names. If there's only one version for each category,
they could be overloaded. My problem is I can't come up with an obvious
second name. Color_F and Color_I (etc) are obvious and simple, so
maybe that's the best option.
(My defintion of "obvious and simple" is: I write a program without
worrying about (or thinking of) this issue, the compile complains where
I use only literals, and I change the needed names. I'd like the name
change to be as easy and obvious as possible. That's why I thought
having only two names would be ideal - the 'normal' name and the 'oops'
name. Possibly using multiple second names is the only practical
option. I'd still like to keep all versions of the 'normal' name, since
I don't always need to specify the type - otherwise, you might as well
keep all of the suffixes used by C - especially if the 'default' is the
one used most often.)
next prev parent reply other threads:[~2010-07-11 2:45 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-08 2:42 OpenGL in Ada Shark8
2010-07-08 14:15 ` John B. Matthews
2010-07-09 2:18 ` anon
2010-07-12 16:51 ` Warren
2010-07-13 12:26 ` Ludovic Brenta
2010-07-13 13:13 ` Warren
2010-07-09 11:43 ` Gautier write-only
2010-07-09 15:11 ` Gene
2010-07-09 17:38 ` Shark8
2010-07-09 20:54 ` Gene
2010-07-12 17:04 ` Warren
2010-07-10 4:00 ` BrianG
2010-07-10 11:47 ` Gautier write-only
2010-07-11 2:45 ` BrianG [this message]
2010-07-11 4:10 ` Gautier write-only
2010-07-11 5:30 ` tmoran
2010-07-11 20:46 ` anon
2010-07-12 14:17 ` Shark8
2010-07-13 0:45 ` BrianG
2010-07-13 17:50 ` anon
2010-07-13 18:37 ` Shark8
2015-01-15 7:11 ` OpenGL in Ada #2 JillRivas
2015-01-30 14:45 ` OpenGL in Ada Lucretia
2015-01-30 18:41 ` David Botton
-- strict thread matches above, loose matches on Subject: below --
2010-10-05 21:23 Yves Bailly
2010-10-06 3:45 ` anon
2010-10-06 5:10 ` Yves Bailly
2010-10-06 9:51 ` Alex R. Mosteo
2010-10-06 10:38 ` Yves Bailly
2010-10-06 10:59 ` Ludovic Brenta
2010-10-06 16:07 ` Pascal Obry
2010-10-06 17:32 ` Yves Bailly
2010-10-06 8:38 ` Gautier write-only
2010-10-07 1:52 ` BrianG
2010-10-07 22:06 ` Yves Bailly
2010-10-08 17:11 ` Shark8
2010-10-08 15:02 ` Lucretia
2010-10-08 20:42 ` Yves Bailly
2010-10-10 19:49 ` Vadim Godunko
2009-10-28 17:12 Opengl " Pablo
2009-10-28 18:01 ` Pascal Obry
2009-10-28 19:04 ` John B. Matthews
2009-10-29 6:11 ` Gautier write-only
2000-04-27 0:00 OpenGl in ADA Anderson
2000-04-27 0:00 ` Pascal Obry
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox