Sig,

Since you are focusing on the name of the selector, can I conclude that you are 
using the selector name to make the call?  I am not sure I like that (strongly 
suspect I do not).  Dolphin and FFI use a pragma(-ish??) syntax with the return 
type, function name and argument types explicitly listed.  I very much would 
like to see you handle the details of getting things on and off of the stack, 
but I would like to control the selector name and the types.

As an example, calling something

  waveletTransformForward:comma:comma:

is not nearly as helpful to me as

  waveletTransformForward:size:flag:

The selector can be even more informative than that, but hopefully it starts to 
make the case for the independent selector.

Bill


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Igor Stasenko
Sent: Thursday, May 20, 2010 10:48 AM
To: The general-purpose Squeak developers list; Pharo Development
Subject: [Pharo-project] Need your opinion: What is most appealing form for GL 
function bindings?

There are multiple GL bindings exists by now
- one that used by Croquet (FFI)
- another one that using Alien

and i doing one more, which using NativeBoost for callouts.

And the question, what form of selectors you like most, pros/cons .. i need to 
know, because i can pick any of them, but i hope, that i will not be only one 
who using this stuff, so i need your opinion.

Lets take a usual OpenGL function:

void glVertex3f(GLfloat x, GLfloat y, GLfloat z)

A Croquet/FFI bindings translates it to a following selector:

1. glVertex3f: x with: y with: z

An Alien bindings using following form:

2. glVertex3fX: x y: y z: z

Since my bindings will definitely use underscores, its not a problem to use a 
following one:

3. glVertex3f_x: x y: y z: z

Currently i using this one:

4. glVertex3f: x y: y z: z

In private mail with Andreas, he proposed a following:
---
The one thing I'd consider is to use #comma: as the 'standard' keyword instead 
of #with: for example:

5. glVertex3f: x comma: y comma: z

The reason should be obvious; you're replacing the comma so it should be a 
little more clear than using #with:.
---

6. this option actually not about positional arguments, but about omitting the 
'gl' prefix for each function name.
It is because, you already typing gl at each invocation:

gl glVertex3f: x with: y with: z

so, maybe it worth to omit gl prefix, so, a code will look like:

gl Vertex3f: x with: y with: z

(sure thing, one may use different name for api interface object, not 'gl'.. 
but i think that in 99.9% cases, 'gl' is a natural choice).

---

My own choice is [3].
As to me, it helps greatly when you coding, so, once you autocomplete the 
selector, you know what parameter you need at each position, unlike anonymous 
keywords, like with: or comma: , which don't telling you anything about 
arguments you end up browsing docs each time.
Oh, and btw, each time you need to change something, you again may need to 
refer to docs, since it still may be not clear, what argument types a function 
expects even if you look at already working code.

The pro for picking [1] is mainly be compatible with lots of Croquet code which 
using GL.
Except that, in NB bindings, i taking a constant names as is , i.e.
GL_LINES, while croquet
uses GLLines. So, its still will require porting.


P.S. i'm already having some stuff working (see attachment).. But i little bit 
hesistant to do more, because then , if i reconsider about selector names, it 
will require a lot of fixes all around places.
It generating all these methods automatically, so i can change a form at any 
moment.
NBOpenGL methodDict size 2063
NBWgl methodDict size  132
NBGlx methodDict size 121

--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-project mailing list
[email protected]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

Reply via email to