
Learning Functional Programming in Go
By :

Metaprogramming (MP) is about writing code that writes code. In MP, we write programs that treat programs, even themselves, as input data. Our MP will read, analyze, transform, and generate code.
Maybe we can use MP to fix what's missing in Go due to its lack of support for generics?
Maybe. First, let's get a better understanding of what MP is about.
Here are some examples:
There are several types of MP.
Programs that support the eval
function can generate new code by concatenating strings that represent executable commands. Note: this can pose security risks and is generally not a best practice.
Some languages, such as LISP, can change their own application code based on state information, which provides the flexibility...