On 2/27/15 7:42 AM, H. S. Teoh via Digitalmars-d wrote:
S.foo() should have been annotated with 'return', but the programmer
forgot and the compiler still accepts the code without any warnings,
thereby violating @safe.

That is correct. However, the user is on the hook because her use of @trusted when deallocating the array.

I think the right thing to do about owned data is to give it its own abstraction, and plant it in the standard library. RCSlice would be an obvious go-to structure. Could you consider defining an OwnedSlice and see how far you can get?


Andrei

Reply via email to