On 2014-01-18 13:07, Stanislav Blinov wrote:
That's the approach I took. I've moved both _Transfer and _Clear into
module scope and renamed them. And indeed, the compiler prefers
opDispatch(). But not if I call them like .clearUnique(this) :)
Right, I was mostly thinking of public methods, but those are private.
So the only public method collision that's possible right now is
release(), but there's nothing that can be done about it. If I move it
outside too, compiler would want to call wrong method is encapsulated
type declares its own release().
Does opDot even work?
Yes, but I ditched it too already :)
I've also added some more operations, like casts for class types, null
assignment, and an operator to squeeze the value from the Unique back
into normal type land (discarding "uniqueness", of course). But I feel
kind of uncomfortable having it like an operator, even though this looks
sort of sensible:
a << u; // after that a holds the value and u is null
Maybe this would be better off as another method. What do you think?
Absolutely. We don't want operator overload abuse.
That's how it all looks currently: http://codepad.org/21vejNKK
Now with tests :)