You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something I should have done a long time ago: add an __index to the winapi namespace table that will dynamically look up and publish (i.e. add to the namespace table) symbols from various sub-namespaces:
winapi.SYM -> winapi.C.SYM <- C function, enum or constant
Currently publishing of unwrapped types and functions is done manually, i.e. FooFunc = C.FooFunc or FooType = types.FooType and so on. The idea is to make this publishing happen automatically on first access. After this change, we can remove all these lines in the code.
PS: I am also wondering if there's any benefit to moving constants from the winapi namespace (which is a Lua table) to C enums which are also stored in a Lua table internally, except I heard that access to them is compiled.
PS2: TBH I don't think many people use the low level APIs that much and when they do, they probably wrap them, not use them directly, and it's arguably more readable to see explicit references to these sub-namespaces in the code instead of magic lookups. That being said, anything that helps us remove repetitive tedious code in winapi is a good deal.
The text was updated successfully, but these errors were encountered:
Something I should have done a long time ago: add an __index to the winapi namespace table that will dynamically look up and publish (i.e. add to the namespace table) symbols from various sub-namespaces:
Currently publishing of unwrapped types and functions is done manually, i.e.
FooFunc = C.FooFunc
orFooType = types.FooType
and so on. The idea is to make this publishing happen automatically on first access. After this change, we can remove all these lines in the code.The idea is explained nicely by William Adams: https://williamaadams.wordpress.com/2015/10/26/
PS: I am also wondering if there's any benefit to moving constants from the winapi namespace (which is a Lua table) to C enums which are also stored in a Lua table internally, except I heard that access to them is compiled.
PS2: TBH I don't think many people use the low level APIs that much and when they do, they probably wrap them, not use them directly, and it's arguably more readable to see explicit references to these sub-namespaces in the code instead of magic lookups. That being said, anything that helps us remove repetitive tedious code in winapi is a good deal.
The text was updated successfully, but these errors were encountered: