Chapter 11: Metaprogramming
The last article read was “An
Introduction to Metaprogramming”, an interesting article where Ariel explains
the concept and some examples of metaprogramming.
Starting of describing the
different types of metaprograms, like compilers, interpreters, parser
generators, assemblers and preprocessors, metaprograms come in many shapes and
forms, which main goal is to eliminate or reduce error-prone programming tasks.
I have heard of this concept as a utopic approach to things, however, I haven’t
seen metaprogramming first hand. At first, I thought it was a really complex
way to do things, but after reading the article, it doesn’t go that deep into
weirdness.
Beginning with the first
example; it clarified how the concept of metaprogramming works, a script that
wrote another file with the code expected. While the ruby snippet shown was not
some other world stuff, but the example is pretty clear, we can write codes
through code.
Now, the second example goes
a little bit deeper, but it isn’t a really complex code whatsoever. It still
keeps the simplicity of how we can write this type of codes and expect great
utility from them.
Concluding, I started a
little skeptical about the concept of programs that wrote programs, but now
that I see how this concept is being brought to practice, I now understand its
simplicity and use. I think this can be a really interesting and powerful tool
to be developed in the years to come. I mean, we have machines that build
machines, now we have programs that make programs, what’s next, humans that
make humans? O wait, I think we already do that.
I hope to see more metaprogramming
thought the course and career. The implementation seen in the article may only scratch
the surface, it would be interesting to know to which limits can we take this approach.
References:
Ortiz Ariel (2007). An Introduction
to Metaprogramming. Available on: http://webcem01.cem.itesm.mx:8005/s201713/tc3049/metaprogramming.html
Comments
Post a Comment