Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for compile time reflection #604

Open
reinco opened this issue Apr 26, 2024 · 0 comments
Open

Add support for compile time reflection #604

reinco opened this issue Apr 26, 2024 · 0 comments
Labels
c++ C++ language generator enhancement New feature or request
Milestone

Comments

@reinco
Copy link

reinco commented Apr 26, 2024

ZSerio currently supports runtime reflection.
There is no compile time reflection. With compile time reflection one can:

  1. iterate over the members of a c++ struct
  2. iterate over the names of the c++ fields.
    If a structure has compile time reflection one can define template functions that can work on any such struct.
    For example a comparison operator, hash function, json or yaml generated for a struct.

Compared to runtime reflecting it has the following advantages:

  1. Errors in code are discovered at compile time instead of runtime.
  2. Better runtime performance
  3. templated function can be in a seperate header that you don't include if you do not need it. This prevents discussions on what functions a struct generated for a zserio struct must support and prevents code blot in the code emitted by the zserio compiler.
@reinco reinco added the enhancement New feature or request label Apr 26, 2024
@mikir mikir added the c++ C++ language generator label May 27, 2024
@mikir mikir added this to the Backlog milestone May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ C++ language generator enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants