On Wednesday, 18 March 2015 at 13:01:50 UTC, Oren Tirosh wrote:
The scope storage class is a two way contract. The function promises not to escape the reference. The caller promises to ensure the storage that the reference is pointing to will remain valid for the duration of the function call. In some cases, the caller code may need to take active steps to ensure that, like keeping an otherwise temporary reference alive to prevent it from being deallocated.

But what if the pointer is null? Can this be considered to fulfill the caller's part of the deal?

Yes, the old @notnull debate again. For me, @safe by default and scope by default also suggests @notnull by default for scope references. Sorry if this opens up directions you don't want to think about at the moment...

Don't be sorry, I agree with you 100%, and you stated it more clearly than i could have.

Reply via email to