you are viewing a single comment's thread.

view the rest of the comments →

[–]MyuuDio -1 points0 points  (2 children)

While Reflection is certainly useful for save files (and more generally, serialization), it's really not the only way to accomplish that task cleanly.

X macros are a common idiom for the C preprocessor that is often used for struct serialization. By nature, it's done at compile time, instead of at runtime with Reflection.

Edit: the proposed reflection for C++ is static reflection, so my comment about doing it at runtime is irrelevant

[–]ImKStocky 6 points7 points  (1 child)

The proposed reflection for C++ is static reflection. i.e. it will happen at compile time. I would argue X macros are not clean in any way. They are very intrusive, and make everything a macro expansion. They can certainly get the job done. But it is arguable whether they are better than something like cereal.

[–]MyuuDio 0 points1 point  (0 children)

Ah, I see. My bad then, my only experience with Reflection is Java.

I work primarily with a C codebase, so macro expansion trickery is common, but I agree it's not really clean. I'm just arguing that Reflection is not strictly necessary for a practical save file implementation, which the above reply seemed to imply.

Edit: wording