[phobos] Using writeln on shared objects?
Sean Kelly
sean at invisibleduck.org
Thu Sep 30 15:50:36 PDT 2010
Here's the test case:
auto e = new shared(Exception)("hi");
writeln(e);
and the error:
std/format.d(1293): Error: function object.Throwable.toString () is not callable using argument types ()
I'm guessing this is because toString() isn't a shared method. Interestingly, also means that it isn't possible to put a shared class into a Variant, since it provides a toString method. So I guess it's becoming pretty important to sort out the qualifiers for Object methods. I'd considered providing both a shared and unshared toString (and others), but then child classes defining only one get compile errors about hiding the method in question. It doesn't seem reasonable to expect people to supply both, and I don't believe inout works for the hidden "this" parameter, so... ideas? I don't know that we can provide only a shared version of these methods because they may reference non-shared static data so I'm at a bit of a loss for what to do.
More information about the phobos
mailing list