Last active
October 22, 2015 16:32
-
-
Save mzemel/b63401499e3787125ac8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Tracer do | |
defmacro def(definition, do: expression) do | |
{name, _, args} = definition | |
quote do | |
Kernel.def(unquote(definition)) do | |
IO.puts "==> call: #{unquote(name)} (#{unquote(args)})" | |
result = unquote(content) | |
IO.puts "<== result: #{result}" | |
result | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment