Advertisement
Advertisement
β‘ Community Insights
Discussion Sentiment
88% Positive
Analyzed from 475 words in the discussion.
Trending Topics
#reflection#example#string#enum#inline#variable#compiler#same#used#using
Discussion Sentiment
Analyzed from 475 words in the discussion.
Trending Topics
Discussion (18 Comments)Read Original on HackerNews
It would be cool if the stated goal of C++29 was compile times.
And template for but I assume that's like inline for like in zig.
Not familiar with Zig but AFAICT `inline for` is about instructing the compiler to unroll the loop, whereas `template for` means it can be evaluated at compile time and each loop iteration can have a different type for the iteration variable. It's a bit crazy but necessary for reflection to work usefully in the way the language sets it up.
https://ziglang.org/documentation/master/#inline-for
We've come full circle huh?
Why do you need this, logging? In that case I would rather reflect the logging statement to pribt any variable name, or hell, just write out the string.
If saving for db, maybe store as string, there's more incentive for an enum in the db, if that's a string you might as well. At any rate it doesn't seem a great idea to depend on a variable name, imagine changing a variable name and stuff breaks.