scope for array parameters
Jonathan M Davis
jmdavisProg at gmx.com
Tue Sep 4 13:24:01 PDT 2012
On Tuesday, September 04, 2012 22:13:44 Benjamin Thaut wrote:
> What do you think about this idea?
scope on function parameters is supposed to prevent any reference to that data
escaping from the function. e.g. scope on a delegate would make it an error to
assign that delegate to anything which could escape the function. It is my
understanding that this is also supposed to include arrays such that if you
mark an array parameter with scope, it should be illegal for any references to
it (including slices of it or references to its elements) to escape the
function, which _would_ allow compiler optimizations. But the compiler doesn't
seem to properly check for much with regards to scope right now. A _lot_ of
code is going to break once it does, particularly since some people seem to
think that it's a good idea to use in (which is the same as const scope)
everywhere.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list