Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Kernel.dbg/0 which debugs binding/0 #12009

Merged
merged 2 commits into from Jul 25, 2022
Merged

Add Kernel.dbg/0 which debugs binding/0 #12009

merged 2 commits into from Jul 25, 2022

Conversation

whatyouhide
Copy link
Member

As discussed with @josevalim.

@whatyouhide whatyouhide merged commit eead8de into main Jul 25, 2022
@whatyouhide whatyouhide deleted the andrea/dbg-0 branch July 25, 2022 06:59
@@ -5846,7 +5848,7 @@ defmodule Kernel do
are inspected. They are the same options accepted by `inspect/2`.
"""
@doc since: "1.14.0"
defmacro dbg(code, options \\ []) do
defmacro dbg(code \\ quote(do: binding()), options \\ []) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this default is unfortunately not printed nicely in iex:

image

should we break up docs into dbg/0 and dbg/1,2?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also make the default be \\ quoted_binding() and get better formatting at the cost of "hiding" more?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no preference here 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants