* **I find partial casing can better enforce the casing style**


Your organization must have a style guide and it must say something about 
naming convention and casing style (What? You don't have such thing? How crazy 
are you people!). And all of you are following that casing style. Then, you 
decide to use some external library. The problem then arise, as the library is 
written in another casing style! So you guys loosen the style guide and add an 
exception rule to your casing style, saying that "When using an external 
library, use whatever the f*** the library uses" (Your style guide have that, 
doesn't it?). And your code become a messy mix of different casing style.

With partial casing, who give a f*** about the library author's casing style? 
Just follow the style guide, no matter what.

* * *

  * **About OpenGL, that's another story**



Wrapping OpenGL C headers is the wrong way to go.

Modern OpenGL should only be "loaded" dynamically at runtime, with the "loader" 
generated from "the XML registry", which is a set of XML files containing all 
the definitions of functions/enums/structs/etc for OpenGL core and extensions. 
That's why people use GLEW or things like that, and it is recommended not to 
use anything from `<GL/gl*.h>` and should not link against `libGL.so`/etc.

So, you don't wrap OpenGL C headers, you just generate native Nim binding from 
the registry. Let's have a look at the registry about `GL_INT`:
    
    
            <group name="ColorPointerType">
                <enum name="GL_BYTE"/>
                <enum name="GL_DOUBLE"/>
                <enum name="GL_FLOAT"/>
                <enum name="GL_INT"/>
                <enum name="GL_SHORT"/>
                <enum name="GL_UNSIGNED_BYTE"/>
                <enum name="GL_UNSIGNED_INT"/>
                <enum name="GL_UNSIGNED_SHORT"/>
            </group>
            
            <group name="IndexPointerType">
                <enum name="GL_DOUBLE"/>
                <enum name="GL_FLOAT"/>
                <enum name="GL_INT"/>
                <enum name="GL_SHORT"/>
            </group>
            
            <group name="ListNameType">
                <enum name="GL_2_BYTES"/>
                <enum name="GL_3_BYTES"/>
                <enum name="GL_4_BYTES"/>
                <enum name="GL_BYTE"/>
                <enum name="GL_FLOAT"/>
                <enum name="GL_INT"/>
                <enum name="GL_SHORT"/>
                <enum name="GL_UNSIGNED_BYTE"/>
                <enum name="GL_UNSIGNED_INT"/>
                <enum name="GL_UNSIGNED_SHORT"/>
            </group>
            
            <group name="NormalPointerType">
                <enum name="GL_BYTE"/>
                <enum name="GL_DOUBLE"/>
                <enum name="GL_FLOAT"/>
                <enum name="GL_INT"/>
                <enum name="GL_SHORT"/>
            </group>
            
            <group name="PixelType">
                <enum name="GL_BITMAP"/>
                <enum name="GL_BYTE"/>
                <enum name="GL_FLOAT"/>
                <enum name="GL_INT"/>
                <enum name="GL_SHORT"/>
                <enum name="GL_UNSIGNED_BYTE"/>
                <enum name="GL_UNSIGNED_BYTE_3_3_2"/>
                <enum name="GL_UNSIGNED_BYTE_3_3_2_EXT"/>
                <enum name="GL_UNSIGNED_INT"/>
                <enum name="GL_UNSIGNED_INT_10_10_10_2"/>
                <enum name="GL_UNSIGNED_INT_10_10_10_2_EXT"/>
                <enum name="GL_UNSIGNED_INT_8_8_8_8"/>
                <enum name="GL_UNSIGNED_INT_8_8_8_8_EXT"/>
                <enum name="GL_UNSIGNED_SHORT"/>
                <enum name="GL_UNSIGNED_SHORT_4_4_4_4"/>
                <enum name="GL_UNSIGNED_SHORT_4_4_4_4_EXT"/>
                <enum name="GL_UNSIGNED_SHORT_5_5_5_1"/>
                <enum name="GL_UNSIGNED_SHORT_5_5_5_1_EXT"/>
            </group>
            
            <group name="TexCoordPointerType">
                <enum name="GL_DOUBLE"/>
                <enum name="GL_FLOAT"/>
                <enum name="GL_INT"/>
                <enum name="GL_SHORT"/>
            </group>
            
            <group name="VertexPointerType">
                <enum name="GL_DOUBLE"/>
                <enum name="GL_FLOAT"/>
                <enum name="GL_INT"/>
                <enum name="GL_SHORT"/>
            </group>
            ...
            <enum value="0x1404" name="GL_INT"/>
            ...
    

Guess what, they are grouped and they are enums! And the same name is reused 
for different things.

The C header is just how the C people interpret it -- they just `#define` them, 
ignoring the groups and types (It's enum dude!). Why the hell do the Nim OpenGL 
guy do the same thing with a much richer language? Why are they implement enums 
as `const` s?

With such detailed information in the registry, the lowlevel Nim binding SHOULD 
be better than the C binding (Yes, the C is also a "binding" and not the 
authentic reference. The machine friendly source of truth about OpenGL is the 
XML registry). We can have `"PixelType.`int`"` instead of `cGL_INT` for example.

* * *

  * **About controlling nim settings with a xxx.nim.cfg for 
naming_break_on_case/etc**



It may work, but not like that.

In fact, the authentic truth of an identifier should be in 
`snake_case_WITH_Capital_letters_allowed` style, because it contains most 
information than other casing styles.

For example, `get_HTTP_SID_descriptor` can be easily converted to 
`getHttpSidDescriptor`, but it's impossible to reverse that -- How do you know 
that HTTP need to be in ALL_CAPS?

So, it's difficult to do "break on ..." or "convert ..." correctly when 
importing, but "ignore ..." can be easily done in a module, like this:

  * identifier_comparison_ignore_underscore
  * identifier_comparison_ignore_case_first_letter
  * identifier_comparison_ignore_case_rest_letters


Reply via email to