jmg3000
7/7/2006 6:25:00 PM
On 7/7/06, Bill Kelly <billk@cts.com> wrote:
> From: "John Gabriele" <jmg3000@gmail.com>
> >
> > I'm not trying to be the new maintainer of ruby-opengl per se.
>
> Rats. Because I really liked the web site. :)
Hey, thanks. :) I don't think it's gone for good, I just don't want to
false advertise. Thanks for pointing out the problem.
> > I just
> > wanted to use more normal lookin gl calls in my little hobby-type gl
> > apps, and so modified ruby-opengl to make it so.
>
> Incidentally, I'd wager the reason the C-style GL calls all
> use function name prefixes, is because that's standard practice
> in 'C', since there's no namespace or module-like mechanism.
>
> I doubt whether we'd prefix all our functions like that in
> 'C' if we had an alternative.
Then what would you think of GL::foo_bar instead of glFooBar? I really
don't like ruby-opengl's current GL::FooBar, since that looks like a
constant to me in Ruby.
The trouble with *that* though (using GL::foo_bar), is, if you
`include` the GL, GLU, and GLUT modules, you might then have possible
name collision issues (if you take away the prefix, the GL function
names start looking pretty common).
> That's why Yoshi's placing the GL calls into modules never
> bothered me, for the ruby bindings. It seemed a reasonable
> fit for a language that _does_ have namespaces. (Why preserve
> a 'C' language convention that exists only to work around
> that language's lack of namespaces?)
Well, the reasons that make sense to me are:
1. Lots of OpenGL C code uses those names, so it would likely make
"porting" a lot easier (not that you'd often port working C code to
Ruby, but "porting" could mean just turning pseudocode into Ruby, for
example, or maybe C snippets you find on the 'Net). Probably much more
common would be to first write your GL code in Ruby, then, if
necessary for performance reasons, you might end up recoding it in C.
Using normal GL names would make this much simpler, I think.
2. Folks are already used to the glFooBar names, which are quite well
established.
3. It makes it easier for folks new to Ruby and/or GL to follow along
with the many tutorials on the 'Net (since they mostly all are for C
and use the customary gl names).
4. If I do preserve the namespaces, then I'm stuck with function names
in Ruby that start with a capital letter, which really don't look
right for Ruby.
>
> In any case - welcome to Ruby!
Thanks. :)