The next iteration of scope
digitalmars-d at puremagic.com
Sun Mar 15 12:11:34 PDT 2015
On Sunday, 15 March 2015 at 17:31:17 UTC, Nick Treleaven wrote:
> On 15/03/2015 14:10, "Marc =?UTF-8?B?U2Now7x0eiI=?=
> <schuetzm at gmx.net>" wrote:
>> Here's the new version of my scope proposal:
>> It's still missing real-life examples, a section on the
>> and a more formal specification, as well as a discussion of
>> compatibility. But I thought I'd show what I have, so that it
>> can be
>> discussed early on.
>> I hope it will be more digestible for Walter & Andrei. It's
>> more or less
>> an extended version of DIP25, and avoids the need for most
> I too want a scope attribute e.g. for safe slicing of static
> arrays, etc. I'm not sure if it's too late for scope by default
> though, perhaps.
If we get @safe by default, we automatically get scope by
> I like postblit overloading on whether 'this' can be scope or
> not, allowing efficient ref-counting.
> scope T payload;
> ^ This is a nice way to help enforce the correctness of @safe
> wrapper types.
Yes, it's an exception to the general rule of "scope only in
function signatures", but it's so useful I think it's worth it.
More information about the Digitalmars-d