lua-users home
lua-l archive

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

On Friday 22 September 2006 13:39, Alex Queiroz wrote:
>       For a *very* thin OpenGL binding I once wrote I used
> GL.clear("Color", "Depth")

Immutable strings might allow interfaces like this to be optimized a 
great deal, as you can just look at the pointers. The C function 
would have a table of pointers to the known "keyword" strings. For a 
hardwired interface, it might be possible to do it even faster, 
depending on the characteristics of the strings.

Another idea would be to use numeric constants instead of strings. For 
a 32 bit mask, you only need 5 bits for the index, so you could use 
the rest of the bits for some type of "magic" type ID, for run time 
type checking.

(EEL has an enum type for this kind of stuff, where a value contains 
the actual enum value, as well as a reference to the enum class, for 
type checking. Haven't had the time to integrate it properly with the 
language though, so I'm not sure how useful it is in real life.)

//David Olofson - Programmer, Composer, Open Source Advocate

.------- - Games, SDL examples  -------.
| - 2.5D rendering engine       |
| - Music/audio engine          |
| - Real time scripting         |
'-- - Rheology instrumentation  --'