Steven Schveighoffer Wrote:

> On Tue, 10 Aug 2010 20:28:32 -0400, bearophile <[email protected]>  
> wrote:
> 
> > Jonathan M Davis:
> >> If attempts to use any reference types in destructors were a  
> >> compile-time error
> >> with a clear error message, that could go a long way in stopping people  
> >> from
> >> trying to misuse destructors.
> >
> > This sounds like a positive idea, maybe fit for an enhancement request.
> 
> No, reference types are not necessarily heap allocated.  Guys, the  
> distinction is heap vs. manual, not reference vs. value.  Value types can  
> be on the heap, and references can refer to non-heap data.
> 
> Adding artificial restrictions that force casting are not going to help at  
> all.
> 
> -Steve

I disagree. The distinction should be owned vs. not-owned and NOT heap vs. 
manual. Hence values vs. references. 

Simply put:
case 1)
  struct S;
  class C { S s;} // a C instance *owns* a S instance

case 2)
  class B;
  class C { B b; } // a C instance does *not* own a B instance

I believe that anything more complicated would require Bartosz' ownership 
system.

Reply via email to