DbgMacro.jl

Debugging macros
Author FedericoStra
Popularity
1 Star
Updated Last
6 Months Ago
Started In
November 2020

DbgMacro.jl

Lifecycle Stable Dev Build Status Code Style: Blue ColPrac: Contributor's Guide on Collaborative Practices for Community Packages

This package provides four macros: @dbg, @dumpct, @dumprt and @qn.

When executing

@dbg ex1 ex2 ex3 ...

the macro generates code that displays all the expressions in the same way as @show does, each on a separate line, preceded by the location in the format module:file:line. The output goes to stderr. Useful for debugging.

It is inspired by Rust dbg! macro.

The macros @dumpct and @dumprt

@dumpct expression
@dumprt expression

dump the provided expression at compile-time or run-time respectively.

The macro @qn

@qn expression

returns the quoted expression without interpolating contained $.

Examples

julia> using DbgMacro

julia> m = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> @dbg 1+2 "Hello" m
Main:REPL[3]:1  1 + 2 = 3
Main:REPL[3]:1  "Hello" = "Hello"
Main:REPL[3]:1  m = [1 2; 3 4]