DIP71: 'noscope' and 'out!param' attributes
Zach the Mystic via Digitalmars-d
digitalmars-d at puremagic.com
Sun Jan 18 10:12:56 PST 2015
http://wiki.dlang.org/DIP71
I want to keep this simple. There are three ways for a reference
passed to a function to escape that function.
static T* s;
T* fun(T* p1, T** p2) {
// escape by global
s = p1;
// escape by return
return p1;
// escape by mutable argument
*p2 = p1;
}
Because escape by return is by far the most common, adding
'return' parameters as in DIP25 clearly makes a lot of sense. It
just bugs me that the other two types of escape are still
possible. I think they shouldn't be. DIP71 introduces two new
attributes, "out!param" and "noscope" to address this.
I have a lot of other thoughts about this issue, but I want to
save them for a different thread.
More information about the Digitalmars-d
mailing list