Newbie initial comments on D language - scope

Walter Bright newshound1 at digitalmars.com
Wed Jan 30 02:58:36 PST 2008


Edward Diener wrote:
> Understand that I am not saying that the user of an object of a scope 
> class can not benefit from knowing, if he chooses, that the class is a 
> scope class. Part of my suggestion about the keyword 'scope' in D is 
> that when used it should force any object, even not normally scoped, to 
> be destroyed when it goes out of scope. In this way the programmer can 
> force a container of scoped objects to be destroyed immediately when it 
> goes out of scope even though the container is not a scoped type.

You both have good points, but the problem with scoped classes are there 
  are semantic problems with them if they are not carefully used.

I'm working on adding destructors to structs, which I'm thinking should 
completely supplant scoped classes. RAII is a much more natural fit with 
structs than it ever will be for classes.



More information about the Digitalmars-d mailing list