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

Consider making positive infinity stringify as "inf" instead of "+inf" #242

Open
brandjon opened this issue Jan 31, 2023 · 0 comments
Open

Comments

@brandjon
Copy link
Member

The spec doesn't take a position on the stringification for most types. But in practice, the Java and Go implementations agree that positive infinity gets turned into "+inf" rather than "inf". This causes issues for Bazel's current textproto serialization, where "+inf" is not valid but "inf" is.

The obvious fix is to handle this specially in the textproto serialization logic. But the question came up of whether we should instead change the general convention for Starlark floats.

Argument: "+inf" is not consistent with Python, which uses "inf". But then again, our NaN behavior is completely different from Python, so maybe we're less bound by precedent here.

Argument: "+inf" is nicely symmetric to "-inf". But then again, we don't stringify positive float zero to "+0.0".

Argument: Go distinguishes positive infinity with a plus. But it uses "+Inf" rather than lower "+inf". And Go's precedent matters less than Python's.

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

No branches or pull requests

1 participant