HaxeFoundation / HaxeFoundation/hxcpp
std::type_index for class IDs
- Dominant language
- C++
- Stars
- 330
- Forks
- 227
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 18
Description
I've been thinking about what using the C++11 `std::type_index` in combination with `typeid` would allow if that were to be used as the basis for type IDs instead of IDs generate by the haxe compiler.
Now that the `cpp.ManagedType` metadata allows externing custom `hx::Object` subclasses it would be nice to have a `hx::Throwable` class which all exceptions (including `haxe.Exception`) inherit, this would mean hxcpp internals wouldn't be throwing around strings. The problem with this is that exceptions require type checking to work and with the haxe compiler generating type IDs having that base class implemented in hxcpp makes things a bit of a pain. If `std::type_index` were used type checking against custom `hx::Object` subclasses suddenly becomes much more feasible.
This could also open up the possibility of the haxe compiler generating reflection / closure support for externed `hx::Object` subclasses to save the user needing to hand write it to work with the existing setup.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.