Re: Python extension commands in git - request for policy change
- From
Joshua Jensen <jjensen@workspacewhiz.com>
- Date
- Dec 12, 2012, 05:15 UTC
- Message-ID
- <50C812E1.4020108@workspacewhiz.com>
- In-Reply-To
- <CACh33FqTBOMar=V8=aiE2asZ_ri37fAqeghJLqGecYk=qtvBiQ@mail.gmail.com>
----- Original Message ----- From: Patrick Donnelly Date: 12/11/2012 7:26 PM
Show 8 quoted lines
>> If we use lua for writing "builtin" commands, >> we'll need to export a lot of C functions and writing wrappers like >> this is boring and time consuming. Also, assume I export fn(char*,int) >> to Lua, then I change the prototype to fn(char*, char*), can Lua spot >> all the call sites at compile time (or something) so I can update >> them? > If the API calls are generic (don't require special handling), you can > use some preprocessor magic to save time/space.
Since I mostly use C++, thanks to template metaprogramming, I get to register functions like so:
void SomeExistingFunction(char* str, int num);
luaState->GetGlobals().RegisterDirect("SomeExistingFunction", SomeExistingFunction);
I certainly am not suggesting C++ be used within Git, but in this case, C++ has some nice compile-time advantages.
:)
-Josh