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

to!string and format don’t handle infinite ranges #10559

Open
dlangBugzillaToGithub opened this issue Aug 21, 2024 · 0 comments
Open

to!string and format don’t handle infinite ranges #10559

dlangBugzillaToGithub opened this issue Aug 21, 2024 · 0 comments

Comments

@dlangBugzillaToGithub
Copy link

ogion.art reported this on 2024-08-21T13:09:02Z

Transfered from https://issues.dlang.org/show_bug.cgi?id=24713

Description

It is desirable to be able to stringize all existing D types (with `noreturn` being exception). Currently, this doesn’t even compile:
import std.range, std.conv;
void main() {
    auto s = 42.repeat.to!string;
}
> Error: none of the overloads of template `std.conv.toImpl` 
> are callable using argument types `!(string)(Repeat!int)`

And this compiles but gets stuck in an infinite loop:
import std.range, std.format;
void main() {
    auto s = format("%s", 42.repeat);
}

An infinite range could be denoted by printing its first three elements followed by an ellipsis (in this case: "[42, 42, 42, ...]").
@LightBender LightBender removed the P1 label Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants