On Tuesday, March 28, 2017 22:15:33 Ali Çehreli via Digitalmars-d-learn wrote: > (More correctly, "scope storage class".) > > https://dlang.org/spec/function.html#Parameter > > still says > > scope: references in the parameter cannot be escaped > (e.g. assigned to a global variable). Ignored for > parameters with no references > > However, it doesn't behave that way. For example, my example here > currently is a lie because there is no compilation error with 2.073.2: > > > http://ddili.org/ders/d.en/function_parameters.html#ix_function_parameters > .scope > > What's the truth? How would you change the text there? > > Thank you, > Ali
Not sure when that was changed, since that's not what the spec used to say on scope. IIRC, it used to be that it did not say anything about references and was _very_ vague. But unless something major has changed, _all_ scoped does at this point is make it so that a delegate will not allocate a closure. I'm not sure that it's even properly checked for escaping (though it may be). But scoped has zero effect on other types. Now, I believe that Walter has been working on stuff that would change that, but I don't think that any of that has made it in yet except maybe with a compiler switch intended to separate out the changes until they're ready. - Jonathan M Davis