Scope storage class

Brad Roberts braddr at bellevue.puremagic.com
Thu Nov 27 21:50:32 PST 2008


On Thu, 27 Nov 2008, Walter Bright wrote:

> Jarrett Billingsley wrote:
> > So my suspicion is correct, then?  That is:
> > 
> > scope int delegate() b;
> > b = { ... };
> > 
> > Will allocate on the heap?
> 
> Yes. The scope for delegates takes effect as a parameter storage class, not a
> local variable storage class. The reason is because it is the called function
> that decides what it's going to do with the delegate.

Walter, this is yet more evidence that shows that accepting and ignoring 
these sorts of modifiers is the wrong thing to do.  Accepting dubious 
definitions like 'public private int foo' and the above make life harder 
than it needs to be.

Later,
Brad


More information about the Digitalmars-d-announce mailing list