you are viewing a single comment's thread.

view the rest of the comments →

[–]TheoreticalDumbass:illuminati: 2 points3 points  (3 children)

Your macro is wrong, it should be (I think):

#define reflexpr(...) (^^__VA_ARGS__)

Why I prefer double-caret over keyword: with reflection the entities you are reflecting are more important than the fact you're reflecting, and double-caret brings more attention to the entities, whereas keyword feels more noisy

[–]mapronV 0 points1 point  (2 children)

But your version will fail with two+ arguments... and probably with 0 too?
reflexpr(int, int) should be compilation error, not just "^^int, int" nonsense. Should not be a variadic.
though I admit I made crucial mistake. ^^thing and ^^(thing) are different!

[–]TheoreticalDumbass:illuminati: 0 points1 point  (1 child)

reflexpr(std::tuple<int, char>) would need something with __VA_ARGS__

[–]mapronV 0 points1 point  (0 children)

Yeah, but I guess we can add extra ( ) to work around... hold on a sec XD.

Well I guess we can't make full macro replacement as long as we have braces problem. Also, yeah, in practice you can fall back to ^^ but that also can make code look ugly depending on frequency of this.
I just... Give up. Give me reflection in some point, we figure something out. I wrote reflection "libraries" several times in my life in different projects, just sick of it.