Skip to content

std::type_index for class IDs #1295

@Aidan63

Description

@Aidan63

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions