RFC, ensureHeaped

Jonathan M Davis jmdavisProg at gmx.com
Mon Nov 15 10:36:42 PST 2010


On Monday, November 15, 2010 07:28:33 Steven Schveighoffer wrote:
> On Fri, 12 Nov 2010 20:33:37 -0500, Jonathan M Davis <jmdavisProg at gmx.com>
> 
> wrote:
> > On Friday, November 12, 2010 17:25:31 bearophile wrote:
> >> Jonathan M Davis:
> >> > I'm not quite sure how that will work with scope going away though.
> >> 
> >> This scope will not go away.
> > 
> > What's the difference between this scope and using scope on a local
> > variable?
> 
> All that is going away is scope classes.  All other uses of scope are
> staying.
> 
> And even then, I think a scope class will still be supported, it just
> won't allocate on the stack (it will probably be a noop like it is for
> other variable types).
> 
> scope means different things in different places.  Currently, in a
> parameter it means that references in the parameter cannot be escaped
> (i.e. assigned to a global variable).  When the compiler sees this on
> delegates, it will avoid allocating a closure when taking the address of a
> local function.  This is essential in opApply loops.
> 
> And you know about the scope for classes.  AFAIK, those are really the
> only two behavior-altering uses.  Other than that, I think it's a noop.

Thanks. I knew about scope classes and scope statements (e.g. scope(failure) 
...), but I didn't know that scope on a parameter was different from scope 
classes. scope is definitely an over-used keyword IMHO.

- Jonathan M Davis


More information about the Digitalmars-d mailing list