How should to!string handle infinite ranges?

Paul Backus snarwin at gmail.com
Tue Mar 4 10:38:24 UTC 2025


We're currently having a discussion about this [on Github][1]. 
The way I see it, there are two reasonable choices:

1. Return a finite string indicating that the range was infinite. 
For example, `"[1, 2, 3, ...]"`.

2. Fail to compile and print a meaningful error message using 
`static assert`. For example, `Can't convert an infinite range to 
a string`.

As a D programmer, which behavior would you find more useful or 
less surprising?

[1]: https://github.com/dlang/phobos/pull/10660


More information about the Digitalmars-d mailing list