-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
Support +inf.0 -inf.0 +nan.0 -nan.0 #166
Conversation
_ => { | ||
self.depth -= 1; | ||
let res = self.format_with_cycles(val, f); | ||
self.depth += 1; | ||
res | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm having some trouble following this change - what was the purpose here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redid this part, I think this is cleaner. I can also revert back to having to separate but similar functions.
- High level: format_with_cycles and top_level_format_with cycles seem to be very similar (difference) so tried to unify.
- Previously reviewed approach: Reused one of the functions when the special cases didn't match. But this means the depth was artificially increased a level. Probably doesn't matter but tried to keep the depth anyways.
- New approach - Pass an enum specifying which behavior to use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it, I understand, I haven't looked at some of these functions in a long time 😄
Required storing a "next" token since
+inf.0
was being parsed as 2 tokens:+
andinf.0
.Seems like this behavior is used to make creating addition functions easy like: