Computational reflection is the ability of a program to modify itself while running. The source code of the program is treated as data by itself os that appropriate modifications can be made by the program during runtime. Programs capable of modifying their own source code, or the source code of some other program, during runtime are called metaprograms. Computational reflection allows the programmer to save time implementing some parts of the program, which are generated by the program itself at runtime.
Metaprogramming can be achieved by three methods:
One advantage of computationally reflective systems is that the program is adaptable at run time. Any program statement can be changed at run time by means of the reflect statement. This system is far superior to method overriding, where the behavior is determined by the method being called at run time.
Read More ยป
Get Techopedia delivered to your inbox!