JuliaLang/julia — pull request #1757 by toivoh (2012-12-14 16:00:30+00:00)
Title: Extend @show: allow multiple args, return value of last

This patch extends the `@show` macro in two ways, to make it more handy in debugging:
* Multiple arguments are allowed, e.g.

x, y = 3, 4
@show x y

prints

x	= 3
y	= 4

* The value of `@show` is the value of it's last argument. Using this, `@show` can be inserted pretty much anywhere in an expression to produce a printout, e.g.

f(args...) = some_computation_based_on_args

can be rewritten to print out its return value like

f(args...) = @show some_computation_based_on_args

instead of

function f(args...)
result = some_computation_based_on_args
@show result
result
end

I haven't come up with a case where it makes much sense to use both features at the same time. If anyone thinks that the value of `@show` with several arguments should be something else, please let me know.