www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - scope keyword

reply Spacen Jasset <spacen razemail.com> writes:
I thought scope was deprecated, but I see that this is still 
here: http://dlang.org/attribute.html#scope

Is it just the uses on classes and local variables that are 
discouraged, but the use in a function signature will continue? 
in == const scope?
Nov 19 2015
next sibling parent Jeremy DeHaan <dehaan.jeremiah gmail.com> writes:
On Thursday, 19 November 2015 at 23:16:04 UTC, Spacen Jasset 
wrote:
 I thought scope was deprecated, but I see that this is still 
 here: http://dlang.org/attribute.html#scope

 Is it just the uses on classes and local variables that are 
 discouraged, but the use in a function signature will continue? 
 in == const scope?
Using scope to allocate on the stack is what you are thinking of, but it was only marked for deprecation. http://dlang.org/deprecate.html#scope%20for%20allocating%20classes%20on%20the%20stack
Nov 19 2015
prev sibling parent Alex Parrill <initrd.gz gmail.com> writes:
On Thursday, 19 November 2015 at 23:16:04 UTC, Spacen Jasset 
wrote:
 I thought scope was deprecated, but I see that this is still 
 here: http://dlang.org/attribute.html#scope

 Is it just the uses on classes and local variables that are 
 discouraged, but the use in a function signature will continue? 
 in == const scope?
The usage of scope as a variable storage modifier to allocate classes on the stack is deprecated, and replaced with std.typecons.scoped. The usage of scope as a parameter attribute is not deprecated, and is used to indicate that references to the parameter will not escape through this function call (ex. the function won't store the parameter in a global variable), though the only thing it affects at the moment is delegates.
Nov 20 2015