Interesting thing with non-escaping ref is that making truly unsealed containers is hard while writing sealed ones made easier(and that's a good thing btw).

But the prime case for specifically unsealed containers is interfacing with C code, it's still there and it's a big niche.
(data structures use in OpenGL, OpenCL and whatnot)

And in order for &container[idx] to seamlessly compile we might try the old trick - return a proxy that hides the pointer within.
Problem is we don't have an overloaded unary & (again it's a good thing).
Another way is to abuse slice operator: container[idx..$] which is then implicitly convertible to a pointer we need so badly.
(yes, I'm talking @system here) Still it's breaking C-styled code base.
And since we started breaking we might as well end up with container.addrOf(idx) or some other helper along the lines.

So by the end of day unsealed containers do lose some nice plain C-like look & feel. -1 reason to actually use them ;)

--
Dmitry Olshansky

_______________________________________________
dmd-beta mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-beta

Reply via email to