Sunday 15 March 2015

c++ - Why don't many compiled languages include compile time Reflection? -


I am researching this topic for potential future data serialization programs. I am very surprised that many popular languages ​​(C ++ mainly but not even corrosion) are not supported, do not compile time reflection.

It often comes in data serialization, looking at a class, the ability to loop on their data members, get their method name, retrieve the name of the class, and all $ DATA_FILE_TYPE is unreliable Push by form.

I am asking from the perspective of one scientist. I often deal with different hardware, storage data is cheaper, not used. Due to being able to safely save the Structors and Classes format for a format and write serializer and deserillizer, it will be astonishing not to worry about changing the class.

The compiled time is a good example of the benefits of reflection. Although it uses a meta-compiler program, in which the source code is read at the first pass, ideally it is not. It's 2015, and for many people it is disappointing not to be able to write a route for the data format of its need (HDF 5, JSON, TXT, ..) like a library.

Am I describing any possible compiled language possible?

C, and therefore C ++, is built on the basic premise "What do you pay for Do not use it. "

The reflection takes a great deal of the outstanding amount. The useful things for a scientist are for an embedded system that is trying to fit just two megabytes of RAM. .

This is a pain, but a library can be applied to reflection. I use such a thing in my code, but only small fist subsystems are required because I am running on the system Where exceptions and plain old RTTIs are very expensive

To resolve: You will see QT. It's a framework for C ++, it provides run-time meta data plus many other things

Edit: Pure compile-time solution: LEX and YACC / FLEX . There is nothing wrong with a vector in any way, but there is no reason that your parser should leave the function of the serialization because many of the Java generators do the work.


No comments:

Post a Comment