Live data from Hacker News

Reflection in C++14: Explanations

blog.simon-ninon.fr

1–10 of 37 posts

Re: Reflection in C++14: Explanations

#3
I applaud your effort and I actually like your result but this just shows how much we need real reflection in C++17. I like to use C++ for its performance and the recent standards were a big leap in the right direction but reflection just isn't one of C++'s strengths.

Re: Reflection in C++14: Explanations

#5
I prefer the C++ configuration over the reflective one. It plays nicely with IDEs and tooling; I can use a debugger on it; I can run code while generating it; it gets verified by type-checking; etc. The only thing it doesn't have is the familiarity bonus of JSON.

Re: Reflection in C++14: Explanations

#6

I applaud your effort and I actually like your result but this just shows how much we need real reflection in C++17. I like to use C++ for its performance and the recent standards were a big leap in the right direction but reflection just isn't one of C++'s strengths.

Afaik reflection doesn't make it into C++17.

Re: Reflection in C++14: Explanations

#8
I wonder how long it'll be before C++ loses its performance advantages. It used to be low level enough that just using it meant you probably got a pretty good performance boost. But if they keep adding features like variants and reflection, and if people actually start using them, it seems like performance will necessarily decline.

Or, if not, other languages will look at C++ to see how they handle these features and keep performance, and improve their compilers.

Re: Reflection in C++14: Explanations

#9
I didn’t want the developer to declare his routes by writing C++ code

...in a web framework in C++, where presumably the developer would need to write C++ anyway to make use of it?

This article is quite long and complex

No kidding. And to me, all that complexity just screams "you're doing it wrong."

I read this article all the way to the end, and was disappointed to find that, after all that code, it ends with a single macro call --- in C++ --- and leaves the reader wondering about the original goal of using JSON.

Years ago I spent a brief amount of time maintaining Java code that was written in this reflection-heavy, everything-configurable (XML and even some ad-hoc text formats, but similar idea) style, and it was not at all enjoyable to get everything set up correctly nor debug the monstrosity. On a somewhat related note, http://discuss.joelonsoftware.com/default.asp?joel.3.219431....

Re: Reflection in C++14: Explanations

#10
post #8

I wonder how long it'll be before C++ loses its performance advantages. It used to be low level enough that just using it meant you probably got a pretty good performance boost. But if they keep adding features like variants and reflection, and if people actually start using them, it seems like performance will necessarily decline. Or, if not, other languages will look at C++ to see how they handle these features and…

Variants and static compile-time reflection will both be a boon to runtime performance. The former means less heap allocation and better locality and the latter means less work at runtime and better in-memory layout (for example, instead of parsing JSON to a hash map you can copy JSON values directly in to your objects)
Post reply on HN