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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5b7ee26df9f9c357 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!.POSTED!not-for-mail From: BrianG Newsgroups: comp.lang.ada Subject: Re: OpenGL in Ada Date: Sat, 10 Jul 2010 22:45:02 -0400 Organization: A noiseless patient Spider Message-ID: References: <68dd0333-f502-4351-9e50-4ec83bddc44e@k39g2000yqd.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 11 Jul 2010 02:41:50 +0000 (UTC) Injection-Info: mx03.eternal-september.org; posting-host="vvBPJT09arwmd97Fw4UIhw"; logging-data="17573"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18WFe3xBPfhwdq0u13720s3" User-Agent: Thunderbird 2.0.0.24 (X11/20100317) In-Reply-To: Cancel-Lock: sha1:uH3ZhfTyQN5Rg768RK6ur+LS97U= Xref: g2news1.google.com comp.lang.ada:12319 Date: 2010-07-10T22:45:02-04:00 List-Id: 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.)