On Monday, 5 January 2015 at 19:21:38 UTC, Steven Schveighoffer
wrote:
On 1/5/15 10:05 AM, Meta wrote:
IMO, inout (and const/immutable to a degree) is a failure for
use with
class/struct methods. This became clear to me when trying to
use it for
the toString implementation of Nullable.
You'd have to be more specific for me to understand your point.
inout was specifically designed for one-implementation
accessors for members of classes/structs.
-Steve
I cannot remember what the exact issue is now as it was awhile
ago, but it had to do with a creating inout/const/immutable
Nullables. When doing something such as `Nullable!TestStruct ts;
writeln(ts)`, the check inside Nullable.get is triggered instead
of calling toString, because toString is not marked as
inout/const/immutable. The only solution seems to have a separate
version of toString for inout, const, and immutable. It seems
that pretty much defeats the point of having inout in the first
place.