October 2014
Intermediate to advanced
280 pages
7h 20m
English
In the body of the def macro, there’s a quote block that defines the actual method. It contains
| | IO.puts "==> call: #{Tracer.dump_definition(unquote(name), unquote(args))}" |
| | result = unquote(content) |
| | IO.puts "<== result: #{result}" |
Why does the first call to puts have to unquote the values in its interpolation but the second call does not?
The built-in function IO.ANSI.escape will insert ANSI escape sequences in a string. If you put the resulting strings into a terminal, you can add colors and bold or underlined text. Explore the library, and then use it to colorize our tracing’s output.
(Hard) Try ...
Read now
Unlock full access