On Friday, 17 January 2014 at 06:25:53 UTC, qznc wrote:

Improving Phobos code by filling in the blanks is usually a good idea and a good learning experience as well.

Oh, I wasn't proposing to stick that into Phobos, not in its current state. I'm not that arrogant :) Even given that I resolve all the TODOs that are currently there, it'd need a lot of discussion beforehand to even be proposed.

Changing an interface in Phobos is a big deal and should be thoroughly justified. Does it break backwards compatibility? Why is it necessary?

Yes, it does. It disallows things like Unique!Car shiny = new Lamborghini(), which are possible in std Unique and are analagous to Unique!Car dubious = createCarAndSneakilySaveLotsOfReferencesToIt(). Initialization is completely taken over by createUnique(), which is basically a non-member implementation of this(Args...)(Args args) (commented out in typecons).

Of course, Unique can not prevent the type itself to advertise aliases all over the application, but that's something that can't be enforced anyway.

Also, its type support is currently very limited (std Unique can have just about anything that can be new'ed), but that's temporary, I'll be extending that.

Other than these, I can't think of any other friction with current implementation. Though I'd have to write tests to be sure.

(btw moving to .learn is not possible, unfortunately)


Reply via email to