std::type_index for class IDs

Open
#1,295 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp
Domain
backend

Research direction

The issue names no files, tests, or entry points. Start by tracing hxcpp type-ID and exception handling internals, then assess how std::type_index and typeid would affect hx::Throwable and externed hx::Object subclasses; the issue does not define a concrete completion criterion.

Written by the indexing model from the issue text.

Description

enhancement

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.

Dominant language
C++
Stars
330
Forks
237
Avg merge
1d 3h
Merged PRs (30d)
20

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from HaxeFoundation/hxcpp

All issues in HaxeFoundation/hxcpp

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.