Skip to content

Issue 6448 - writef("%05d", BigInt) problem #230

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

Merged
merged 8 commits into from
Sep 3, 2011

Conversation

9rnsr
Copy link
Contributor

@9rnsr 9rnsr commented Sep 2, 2011

http://d.puremagic.com/issues/show_bug.cgi?id=6448

BigInt should understand format specifiers ('d', 'x', 'X', 's') just like integers.

Limitation:
The formatting of negative BigInt as hexadecimal is different from built-in integers, because of their internal representations (Two's complement vs sign and absolute).

@donc
Copy link
Collaborator

donc commented Sep 2, 2011

This is great, except there's one thing I really dislike (though it is currently inevitable): it creates a dependency on std.format, and therefore on about 20 other Phobos modules. Up until now, BigInt has been one of the few parts of Phobos that hasn't been part of the big ball of mud. I hope that we'll be able to pull FormatSpec out of std.format eventually. To make that more achievable, can you turn the import into a static import, please?

@9rnsr
Copy link
Contributor Author

9rnsr commented Sep 2, 2011

To make that more achievable, can you turn the import into a static import, please?

Now std.format is already imported with private, then it is not visible from other modules. Is it really necessary?

@donc
Copy link
Collaborator

donc commented Sep 3, 2011

Great. Please also change the import at the top (line 28):

  • private import std.format;
    +private import std.format : FormatSpec, FormatError, formattedWrite;
    and I'll merge it in. (When I said "static import" before, I meant to say "selective import". Makes maintenance easier).
    Note that when we eventually do accurate output of floating-point numbers, std.format is likely to require BigInt, so this may become part of a circular import.

@9rnsr
Copy link
Contributor Author

9rnsr commented Sep 3, 2011

OK, I have done it. Thanks, Don!

donc pushed a commit that referenced this pull request Sep 3, 2011
Issue 6448 - writef("%05d", BigInt) problem
@donc donc merged commit 568b046 into dlang:master Sep 3, 2011
kuettler pushed a commit to kuettler/phobos that referenced this pull request Feb 6, 2018
Merge remote-tracking branch 'upstream/master' into merge_master
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

Successfully merging this pull request may close these issues.

2 participants