Cubyz
Cubyz copied to clipboard
Generalized vtables
Fixes #2211
This is a prototype, I would like feedback on if this is the right direction to go in or not.
I made the hashmap comptime which simplifies the interface a bit.
When you're on it, could you implement inheritance too?
jk
When you're on it, could you implement inheritance too?
Technically this is one-level inheritance
How bad are the error messages (e.g. on missing or incorrect functions)?
When removing the onLoadClient function from the chest I get this error:
src/utils/meta.zig:28:8: error: VTable missing field 'onLoadClient'
@compileError("VTable missing field '" ++ field.name ++ "'");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/utils/meta.zig:8:53: note: called at comptime here
const map: std.StaticStringMap(VTable) = createMap();