Hello everyone! It's been a long time since I last posted here, I've been away from all things D, only being able to take an occasional peek from time to time. It's so good to be back. I'm now finding a bit of time to commit to learn D, more relearn as it would seem.

I've started my rediscoveries with exploring of concurrency, parallelism, threading in D, and after some time I found myself thinking "I need a unique encapsulator". Don't ask why, I may not even be able to answer it in a month. But that helped me solve some problems before in C++, so I thought why not try it here? In a couple of page views I came upon std.typecons and its Unique type. And I thought "why that is exactly what I want!". And it was, too. But after taking a closer look at its general implementation I just couldn't help myself but think "well, it seems it was done in a hurry, never finished, left as it was because this of that and whatnot". I mean, those sparse comments, things like "doesn't work yet", etc... I thought well, since I'm learning the language again, why not make it an exercise and fill those blanks? It'd certainly help me, because it would improve the abstraction I'm using, and because it's a learning experience.

So, here's what I came up with for now:


Granted, not a complete implementation, keeping not very far from the original. But right now I think it's a good time to ask you guys what do you think? Where have I went wrong, what did I do incorrectly, what potential issues can you spot in this? I mean, I'm not asking about using opDot(), which, as I understand it, could be going away anytime now. At least I think I managed to fill in most of the "blanks" of the current implementation while keeping (almost?) to the same interface. In short, please destroy this with Big Fat Phazerz so I could take the remaining ashes and contemplate on the next iteration :)

Reply via email to