unquote

Popularity
500+ learners.
Para inyectar nuevo código o valores podemos usar unquote/1.
To inject new code or values we use unquote/1.
Listo, ahora sabemos como usar quote/2, unquote/1 y escribir macros.
Okay, right now we know how to use quote/2, unquote/1 and write macros.
Cuando hacemos unquote a una expresión esta será evaluada e inyectada dentro del AST.
When we unquote an expression it will be evaluated and injected into the AST.
En cambio en el ejemplo con unquote/1 el código resultante incluye el valor de denominator.
In the unquote/1 example the resulting code includes the value of denominator instead.
Usando unquote/1 en la misma expresión muchas veces conlleva a una revaluación y eso puede tener consecuencias involuntarias.
Using unquote/1 on the same expression multiple times results in revaluation and that can have unintended consequences.
Ya hemos cubierto la utilidad de unquote/1 pero hay otra forma de inyectar valores en nuestro código: el enlazamiento(binding).
We already covered the usefulness of unquote/1, but there's another way to inject values into our code: binding.
Ahora que hemos cubierto quote/2, unquote/1 y defmacro/2 tenemos todas las herramientas necesarias para extender Elixir y adaptarlo a nuestras necesidades.
Now that we've covered quote/2, unquote/1, and defmacro/2 we have all the tools necessary to extend Elixir to suit our needs.
Word of the Day
to flirt