https://github.com/federicostra/dbgmacro.jl
Debugging macros
https://github.com/federicostra/dbgmacro.jl
debug debugging julia macro
Last synced: 4 months ago
JSON representation
Debugging macros
- Host: GitHub
- URL: https://github.com/federicostra/dbgmacro.jl
- Owner: FedericoStra
- License: mit
- Created: 2020-11-27T19:42:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-05T11:02:28.000Z (over 4 years ago)
- Last Synced: 2025-02-23T01:37:57.353Z (over 1 year ago)
- Topics: debug, debugging, julia, macro
- Language: Julia
- Homepage:
- Size: 149 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DbgMacro.jl

[](https://FedericoStra.github.io/DbgMacro.jl/stable)
[](https://FedericoStra.github.io/DbgMacro.jl/dev)
[](https://github.com/FedericoStra/DbgMacro.jl/actions)
[](https://github.com/invenia/BlueStyle)
[](https://github.com/SciML/ColPrac)
This package provides four macros: `@dbg`, `@dumpct`, `@dumprt` and `@qn`.
When executing
```julia
@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!`](https://doc.rust-lang.org/std/macro.dbg.html) macro.
The macros `@dumpct` and `@dumprt`
```julia
@dumpct expression
@dumprt expression
```
dump the provided expression at compile-time or run-time respectively.
The macro `@qn`
```julia
@qn expression
```
returns the quoted expression without interpolating contained `$`.
## Examples
```julia
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]
```