Comment #0 by bearophile_hugs — 2013-12-15T03:04:33Z
A low priority enhancement suggestion.
A way to disallow the printing of a struct is to use @disable on its toString:
struct Foo {
@disable string toString();
}
void main() {
import std.stdio;
Foo f;
writeln(f);
}
But the missing function is only detected at link time (dmd 2.065alpha):
test2.obj(test2)
Error 42: Symbol Undefined _D5test23Foo8toStringMFZAya
So perhaps it's better to add to write a template constraint that verifies toString is not @disabled, to catch the problem at compile-time.