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

change Debug format for fields #228

Merged
merged 1 commit into from
Nov 17, 2023

Conversation

plafer
Copy link
Contributor

@plafer plafer commented Nov 16, 2023

Implements Debug by hand for the base fields such that it outputs a human-readable integer.

The current behavior makes the fields unintuitive when debugging Vec<BaseElement>. Specifically, Vec doesn't implement Display, so we're forced to use the Debug output:

let v: Vec<BaseElement> = vec![BaseElement::from(1u64)];

println!("{v:?}");

// current output: [ BaseElement(<Montgomery form of 1>) ]
// new output: [ 1 ]

I believe most users will be confused by the current output, and would expect to read an integer (as I was).

@plafer plafer changed the title change Debug format change Debug format for fields Nov 16, 2023
Copy link
Collaborator

@irakliyk irakliyk left a comment

Choose a reason for hiding this comment

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

Looks good! Thank you!

@irakliyk irakliyk merged commit 990a620 into facebook:main Nov 17, 2023
9 checks passed
@irakliyk
Copy link
Collaborator

winter-math v0.7.1, which includes this change, has also now been published to crates.io.

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

Successfully merging this pull request may close these issues.

3 participants