I'm researching this topic for a possible future data serialization program. I'm very baffled why many popular languages (C++ mainly, but Rust too) don't see compile time reflection as something to be supported.
This frequently comes up in data serialization. Given a class, the ability to loop over their data members, get their method names, retrieve the class name, and push all that to $DATA_FILE_TYPE would be incredible.
I'm asking from the perspective of a scientist. I frequently deal with lots of different hardware. Storing data is cheap, experiments are not. Being able to cleanly save structs and classes, and writing the serializer and deserializer once for a data format, then not worrying about changing classes would be amazing.
ROOT is a good example of the benefits of compile time reflection. While it uses a meta-compiler program to read the source code on a first pass, ideally it wouldn't have to. It's 2015 and it is frustrating for many people to not be able to write a ROOT like library, for the data format of their choice (HDF5, JSON, TXT, ..).
Is what I am describing possible in any popular compiled language?
Aucun commentaire:
Enregistrer un commentaire