lunes, 6 de noviembre de 2017

An Introduction to Metaprogramming (Commentary)

Metaprogramming seems to be a useful tool when one is actually able to use it to solve a real practical problem. Otherwise, metaprogramming looks like an interesting and enjoyable experiment to understand how a language works.

Basically, metaprogramming referes to the art or science of creating programs responsible of creating other programs and/or running them. When is this useful? When a program can be modified during runtime on interpreted programming languages, when a program requires a lot of repetitive code, or when a program needs to react with a solution on the fly.

For many interpreted programming languages, one of the fundamental solutions for what problems may arise when metaprogramming are the "eval" instructions. What these instructions do basically is transforming strings into interpretable statements.

How about you create a program whose only purpose is to read and execute whatever is found in a text file or even just run a part of a program's source code?

No hay comentarios:

Publicar un comentario

An Introduction to Metaprogramming (Commentary)

Metaprogramming seems to be a useful tool when one is actually able to use it to solve a real practical problem. Otherwise, metaprogrammin...