chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Open question on C binding style


From: minh thu
Subject: Re: [Chicken-users] Open question on C binding style
Date: Thu, 17 Jul 2008 08:56:17 +0200

2008/7/17 Jim Ursetto <address@hidden>:
> On Wed, Jul 16, 2008 at 9:54 PM, Kon Lovett <address@hidden> wrote:
>> 1) When there is a one to one mapping between a Scheme variable/constant & a
>> C variable/macro-constant/constant/enum should the Scheme symbol naming
>> mirror the C naming? Should the C 'SOME_C_LIBRARY_MACCONST' identifier be
>> mapped to the Scheme 'SOME_C_LIBRARY_MACCONST', or some Scheme'ish
>> 'some-c-library-macconst'?
>
>> 2) A C procedure binding name:  'some_c_func' -> 'foreign-some-c-func' ,
>> 'some_c_func', 'C_some_c_func'?
>
> I prefer the scheme style for any exported API.  I use the C style
> only for internal stuff which is basically on the bare metal (maybe
> using a similar schemely name for a nicer wrapper), or when I really
> want to warn the user this is lowlevel stuff.
>
> Example from socket egg, SO_REUSEADDR -> so/reuseaddr (low-level
> integer value), and socket-reuse-address (high-level procedure).  Here
> I did not happen to use "SO_REUSEADDR" verbatim, though that would
> have been acceptable.  I just don't like shouting.
>
> In short, it depends on the egg.

I'm making binding for GLEW (thus making bindings for OpenGL 2.1).
I've chosen gl-vertex3f and GL-POINTS to map glVertex3f and GL_POINTS.

If I write the C code, I would have gl_vertex3f instead (in C).
I think GL-POINTS could be gl-points unambiguaously but maybe
someone would like to write a gl-points as higher level procedure.

And Felix chose gl:Vertex3f and gl:POINTS for the OpenGL bindings.
I guess when I'll release the egg, I'll make the two options
available.

Cheers,
Thu




reply via email to

[Prev in Thread] Current Thread [Next in Thread]